dav/finfo.c

changeset 524
d53fd1006485
parent 522
46f96dcd6eab
child 526
e3c0440bd599
--- a/dav/finfo.c	Thu Mar 14 17:43:31 2019 +0100
+++ b/dav/finfo.c	Fri Mar 15 20:30:09 2019 +0100
@@ -169,7 +169,12 @@
     
     free(attributes);
     
-    return xattr;
+    if(nattr > 0) {
+        return xattr;
+    } else {
+        xattributes_free(xattr);
+        return NULL;
+    }
 }
 
 int resource_set_xattr(DavResource *res, XAttributes *xattr) {
@@ -200,5 +205,10 @@
 }
 
 void xattributes_free(XAttributes *xattr) {
-    
+    free(xattr->hash);
+    for(int i=0;i<xattr->nattr;i++) {
+        free(xattr->names[i]);
+        free(xattr->values[i].ptr);
+    }
+    free(xattr);
 }

mercurial