Skip to content

Commit

Permalink
Fix an xattr free of the wrong object.
Browse files Browse the repository at this point in the history
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 RsyncProject#50.
  • Loading branch information
WayneD committed Jul 7, 2020
1 parent c326927 commit fb6fabc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 7 additions & 8 deletions xattrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fb6fabc

Please sign in to comment.