return NULL when a davql query fails

Thu, 07 Sep 2023 10:29:17 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 07 Sep 2023 10:29:17 +0200
changeset 786
f9d6e4cbcb62
parent 785
645f7e802873
child 787
bd96cbb0e205

return NULL when a davql query fails

libidav/davqlexec.c file | annotate | diff | comparison | revisions
libidav/webdav.c file | annotate | diff | comparison | revisions
--- a/libidav/davqlexec.c	Thu Aug 10 09:40:54 2023 +0200
+++ b/libidav/davqlexec.c	Thu Sep 07 10:29:17 2023 +0200
@@ -631,7 +631,8 @@
         CURLcode ret = do_propfind_request(sn, rqbuf, rpbuf);
         long http_status = 0;
         curl_easy_getinfo(sn->handle, CURLINFO_RESPONSE_CODE, &http_status);
-        //printf("rpbuf: %s %s\n%.*s\n\n", sr->resource->path, sr->resource->href, rpbuf->pos, rpbuf->space);
+        //printf("rpbuf: %s\n%.*s\n\n", root->href, (int)rpbuf->size, rpbuf->space);
+        //fflush(stdout);
         
         if(ret == CURLE_OK && http_status == 207) {
             // in case of an redirect we have to adjust resource->href
--- a/libidav/webdav.c	Thu Aug 10 09:40:54 2023 +0200
+++ b/libidav/webdav.c	Thu Sep 07 10:29:17 2023 +0200
@@ -399,6 +399,14 @@
     va_end(ap);
     
     dav_free_statement(stmt);
+    
+    if(result.status == -1) {
+        if(result.result) {
+            dav_resource_free(result.result);
+            result.result = NULL;
+        }
+    }
+    
     return result.result;
 }
 

mercurial