diff options
author | Wayne Davison <wayned@samba.org> | 2011-09-22 09:02:21 -0700 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2011-09-22 09:13:31 -0700 |
commit | 15df927ae26ff0c0d2e31f2245ce5848346084a4 (patch) | |
tree | 2946b01a7b624ca0bbf299e5a2835dae1917e48f /xattrs.c | |
parent | 8adceeb2b38a7f9f6a2c1fc5a5bf2635927a303b (diff) | |
download | rsync-15df927ae26ff0c0d2e31f2245ce5848346084a4.tar.gz |
Fix xattr memory leak. Fixes bug 8475.
Diffstat (limited to 'xattrs.c')
-rw-r--r-- | xattrs.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -94,11 +94,14 @@ static void rsync_xal_free(item_list *xalp) size_t i; rsync_xa *rxas = xalp->items; + if (!xalp->malloced) + return; + for (i = 0; i < xalp->count; i++) { free(rxas[i].datum); /*free(rxas[i].name);*/ } - xalp->count = 0; + free(xalp->items); } void free_xattr(stat_x *sxp) @@ -773,10 +776,8 @@ void uncache_tmp_xattrs(void) item_list *xattr_start = xattr_item + prior_xattr_count; xattr_item += rsync_xal_l.count; rsync_xal_l.count = prior_xattr_count; - while (xattr_item-- > xattr_start) { + while (xattr_item-- > xattr_start) rsync_xal_free(xattr_item); - free(xattr_item->items); - } prior_xattr_count = (size_t)-1; } } |