diff -r 458a8dc68048 -r f21ee22170bf libidav/methods.c --- a/libidav/methods.c Sat Oct 03 18:11:07 2015 +0200 +++ b/libidav/methods.c Sat Oct 03 19:55:43 2015 +0200 @@ -66,7 +66,7 @@ } UcxBuffer* create_allprop_propfind_request() { - UcxBuffer *buf = ucx_buffer_new(NULL, 512, 0); + UcxBuffer *buf = ucx_buffer_new(NULL, 512, UCX_BUFFER_AUTOFREE); sstr_t s; s = S("\n"); @@ -82,7 +82,7 @@ } UcxBuffer* create_propfind_request(DavSession *sn, UcxList *properties) { - UcxBuffer *buf = ucx_buffer_new(NULL, 512, 0); + UcxBuffer *buf = ucx_buffer_new(NULL, 512, UCX_BUFFER_AUTOEXTEND); sstr_t s; int add_crypto_name = 1; @@ -192,7 +192,7 @@ } UcxBuffer* create_basic_propfind_request() { - UcxBuffer *buf = ucx_buffer_new(NULL, 512, 0); + UcxBuffer *buf = ucx_buffer_new(NULL, 512, UCX_BUFFER_AUTOEXTEND); sstr_t s; s = S("\n"); @@ -254,6 +254,13 @@ return NULL; } +void destroy_propfind_parser(PropfindParser *parser) { + if(parser->document) { + xmlFreeDoc(parser->document); + } + free(parser); +} + int get_propfind_response(PropfindParser *parser, ResponseTag *result) { if(parser->current == NULL) { return 0; @@ -265,6 +272,8 @@ char *crypto_name = NULL; // name set by crypto-name property char *crypto_key = NULL; + result->properties = NULL; + xmlNode *node = parser->current->children; while(node) { if(node->type == XML_ELEMENT_NODE) { @@ -352,6 +361,12 @@ return 1; } +void cleanup_response(ResponseTag *result) { + if(result) { + ucx_list_free(result->properties); + } +} + int hrefeq(DavSession *sn, char *href1, char *href2) { sstr_t href_s = sstr(util_url_decode(sn, href1)); sstr_t href_r = sstr(util_url_decode(sn, href2)); @@ -664,7 +679,7 @@ } UcxBuffer* create_proppatch_request(DavResourceData *data) { - UcxBuffer *buf = ucx_buffer_new(NULL, 512, 0); + UcxBuffer *buf = ucx_buffer_new(NULL, 512, UCX_BUFFER_AUTOEXTEND); sstr_t s; UcxMap *namespaces = ucx_map_new(8); @@ -771,7 +786,7 @@ } UcxBuffer* create_crypto_proppatch_request(DavSession *sn, DavKey *key, char *name) { - UcxBuffer *buf = ucx_buffer_new(NULL, 512, 0); + UcxBuffer *buf = ucx_buffer_new(NULL, 512, UCX_BUFFER_AUTOEXTEND); sstr_t s; s = S("\n");