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>
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);
list_del(&dir_entry->list);
free(dir_entry);
}
+out:
fprintf(stderr, "Making image is aborted.\n");
return -1;
}