fixed incorrect use of UcxBuffer

Fri, 12 Dec 2014 15:48:54 +0100

author
Mike Becker <universe@uap-core.de>
date
Fri, 12 Dec 2014 15:48:54 +0100
changeset 69
0dbdd7e8c1fc
parent 68
f6d3db6113d3
child 70
88092b88ec00

fixed incorrect use of UcxBuffer

libidav/utils.c file | annotate | diff | comparison | revisions
--- a/libidav/utils.c	Fri Dec 12 15:19:38 2014 +0100
+++ b/libidav/utils.c	Fri Dec 12 15:48:54 2014 +0100
@@ -203,7 +203,8 @@
 }
 
 char* util_path_to_url(DavSession *sn, char *path) {
-    UcxBuffer *url = ucx_buffer_new(NULL, 256, UCX_BUFFER_AUTOEXTEND);
+    char *space = malloc(256);
+    UcxBuffer *url = ucx_buffer_new(space, 256, UCX_BUFFER_AUTOEXTEND);
     
     // add base url
     ucx_buffer_write(sn->base_url, 1, strlen(sn->base_url), url);
@@ -230,9 +231,9 @@
     }
     ucx_buffer_putc(url, 0);
     
-    // only free the buffer struct and return the buffer space
-    char *space = url->space;
-    free(url);
+    space = url->space;
+    ucx_buffer_free(url);
+    
     return space;
 }
 

mercurial