mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-03 12:12:05 +00:00
btrfs-progs: subvol show: reset subvol_path to NULL after free
User reported that 'btrfs subvolume show -u -- /mnt' causes double free. Pointer subvol_path was freed in iterations but still keeps the old value. In the last iteration, error BTRFS_UTIL_ERROR_STOP_ITERATION returned, then the double free of subvol_path happens in the out goto label. Set subvol_path to NULL after each free() in the loop to fix the issue. Issue: #317 Signed-off-by: Su Yue <l@damenly.su> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ffd1601236
commit
b431ee33e8
@ -1117,6 +1117,7 @@ static int cmd_subvol_show(const struct cmd_struct *cmd, int argc, char **argv)
|
||||
break;
|
||||
|
||||
free(subvol_path);
|
||||
subvol_path = NULL;
|
||||
}
|
||||
btrfs_util_destroy_subvolume_iterator(iter);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user