--- 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; }