libidav/davql.c

changeset 74
da079dc0724c
parent 43
03076907b58a
child 75
56962faf2b42
--- a/libidav/davql.c	Thu Jan 29 11:43:41 2015 +0100
+++ b/libidav/davql.c	Sun Feb 08 16:36:32 2015 +0100
@@ -76,7 +76,7 @@
     int depth = 1;
        
     // insert variable values
-    UcxBuffer *fbuf = ucx_buffer_new(NULL, 128, UCX_BUFFER_AUTOEXTEND);
+    UcxBuffer *fbuf = ucx_buffer_new(NULL, 1024, UCX_BUFFER_AUTOEXTEND);
     int var = 0;
     for(int i=0;i<from_query.length;i++) {
         char c = from_query.ptr[i];
@@ -137,7 +137,7 @@
     
     DavGetQuery *getquery = malloc(sizeof(DavGetQuery));
     getquery->properties = sstrdup(property_query);
-    getquery->from = sstrn(fbuf->space, fbuf->pos);
+    getquery->from = sstrdup(sstrn(fbuf->space, fbuf->pos));
     getquery->depth = depth;
     if(condition) {
         getquery->condition = condition;
@@ -146,12 +146,17 @@
         getquery->condition = NULL;
         getquery->condlen = 0;
     }
+    
+    ucx_buffer_free(fbuf);
     return getquery;
 }
 
 void free_get_query(DavGetQuery *q) {
     free(q->from.ptr);
     free(q->properties.ptr);
+    if(q->condition) {
+        free(q->condition);
+    }
     free(q);
 }
 

mercurial