dav/finfo.c

changeset 524
d53fd1006485
parent 522
46f96dcd6eab
child 526
e3c0440bd599
equal deleted inserted replaced
523:923a4528a2ae 524:d53fd1006485
167 dav_hash_final(sha256, hash); 167 dav_hash_final(sha256, hash);
168 xattr->hash = util_hexstr(hash, DAV_SHA256_DIGEST_LENGTH); 168 xattr->hash = util_hexstr(hash, DAV_SHA256_DIGEST_LENGTH);
169 169
170 free(attributes); 170 free(attributes);
171 171
172 return xattr; 172 if(nattr > 0) {
173 return xattr;
174 } else {
175 xattributes_free(xattr);
176 return NULL;
177 }
173 } 178 }
174 179
175 int resource_set_xattr(DavResource *res, XAttributes *xattr) { 180 int resource_set_xattr(DavResource *res, XAttributes *xattr) {
176 if(!xattr || xattr->nattr == 0) { 181 if(!xattr || xattr->nattr == 0) {
177 return 0; 182 return 0;
198 203
199 return 0; 204 return 0;
200 } 205 }
201 206
202 void xattributes_free(XAttributes *xattr) { 207 void xattributes_free(XAttributes *xattr) {
203 208 free(xattr->hash);
204 } 209 for(int i=0;i<xattr->nattr;i++) {
210 free(xattr->names[i]);
211 free(xattr->values[i].ptr);
212 }
213 free(xattr);
214 }

mercurial