mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-27 15:30:44 +00:00
btrfs-progs: skip erroneous free before initialization
If the list is not initialized, don't try to free it. Otherwise it will cause segmentfault. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
parent
c543daa68b
commit
64200e4453
3
mkfs.c
3
mkfs.c
@ -965,7 +965,7 @@ static int make_image(char *source_dir, struct btrfs_root *root, int out_fd)
|
||||
ret = lstat(source_dir, &root_st);
|
||||
if (ret) {
|
||||
fprintf(stderr, "unable to lstat the %s\n", source_dir);
|
||||
goto fail;
|
||||
goto out;
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&dir_head.list);
|
||||
@ -987,6 +987,7 @@ fail:
|
||||
list_del(&dir_entry->list);
|
||||
free(dir_entry);
|
||||
}
|
||||
out:
|
||||
fprintf(stderr, "Making image is aborted.\n");
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user