diff options
author | Wayne Davison <wayne@opencoder.net> | 2020-07-07 14:18:28 -0700 |
---|---|---|
committer | Wayne Davison <wayne@opencoder.net> | 2020-07-07 14:25:58 -0700 |
commit | fb6fabc116ec12b238c081b3fb57ab33e8eee0aa (patch) | |
tree | b4c7f02c65e4f9774a0dd06516978bf2e09ad09e | |
parent | c3269275a88380b616ed647abbd775bd43fe5c95 (diff) | |
download | rsync-fb6fabc116ec12b238c081b3fb57ab33e8eee0aa.tar.gz |
Fix an xattr free of the wrong object.
In uncache_tmp_xattrs() the code used to find the value to unlink,
update the single-linked list, and then free the wrong pointer.
This fixes bug #50.
-rw-r--r-- | NEWS.md | 3 | ||||
-rw-r--r-- | xattrs.c | 15 |
2 files changed, 10 insertions, 8 deletions
@@ -8,6 +8,9 @@ - Fixed the specifying of --bwlimit=0 for the default (unlimited). + - Fixed a bug in the xattr code that was freeing the wrong object when trying + to cleanup the xattr list. + ### ENHANCEMENTS: - Allow `--max-alloc=0` to specify no limit. @@ -922,17 +922,16 @@ void uncache_tmp_xattrs(void) continue; } - while (ref != NULL) { - if (ref->next == NULL) { - ref = NULL; + while (1) { + rsync_xa_list_ref *next = ref->next; + if (next == NULL) break; - } - if (xa_list_item->ndx == ref->next->ndx) { - ref->next = ref->next->next; - free(ref); + if (xa_list_item->ndx == next->ndx) { + ref->next = next->next; + free(next); break; } - ref = ref->next; + ref = next; } } prior_xattr_count = (size_t)-1; |