mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-27 00:22:22 +00:00
btrfs: only free root_path if it was allocated from the heap
Noticed this while doing some snapshots in a chroot environment btrfs receive can set root_path to either realmnt, which is passed in from the command line, or to a heap allocated via find_mount_root in do_receive. We should only free the later, not the former, as the former results in an invalid pointer warning from glibc during free. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> CC: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
e3bd2d145f
commit
2cb9b4dbbd
@ -1201,7 +1201,9 @@ out:
|
||||
close(r->write_fd);
|
||||
r->write_fd = -1;
|
||||
}
|
||||
free(r->root_path);
|
||||
|
||||
if (r->root_path != realmnt)
|
||||
free(r->root_path);
|
||||
r->root_path = NULL;
|
||||
r->dest_dir_path = NULL;
|
||||
free(dest_dir_full_path);
|
||||
|
Loading…
Reference in New Issue
Block a user