diff options
author | Gui Hecheng <guihc.fnst@cn.fujitsu.com> | 2014-03-13 13:01:31 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-03-21 09:51:31 -0700 |
commit | 64200e4453f0f23bef42919db7854b6e8ed2ceda (patch) | |
tree | 7586a50d6659c7ccc9bf13b80c7589268b951c80 /mkfs.c | |
parent | c543daa68bfe183149ac2a9446da92577f02ae03 (diff) |
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>
Diffstat (limited to 'mkfs.c')
-rw-r--r-- | mkfs.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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; } |