mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-17 10:16:53 +00:00
btrfs-progs: mkfs: duplicate argument for --rootdir path
The source dir points to the argv data, we should make a copy to be sure it won't change due to further processing. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
54fe8e648a
commit
c33c2c66b3
@ -1114,7 +1114,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
|
||||
PACKAGE_STRING);
|
||||
goto success;
|
||||
case 'r':
|
||||
source_dir = optarg;
|
||||
free(source_dir);
|
||||
source_dir = strdup(optarg);
|
||||
source_dir_set = true;
|
||||
break;
|
||||
case 'U':
|
||||
@ -1748,6 +1749,7 @@ out:
|
||||
|
||||
btrfs_close_all_devices();
|
||||
free(label);
|
||||
free(source_dir);
|
||||
|
||||
return !!ret;
|
||||
error:
|
||||
@ -1755,6 +1757,7 @@ error:
|
||||
close(fd);
|
||||
|
||||
free(label);
|
||||
free(source_dir);
|
||||
exit(1);
|
||||
success:
|
||||
exit(0);
|
||||
|
Loading…
Reference in New Issue
Block a user