libfdisk: fix possible mem leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2015-01-28 15:05:14 +01:00
parent 6a7857d247
commit 9c321dfbf0
1 changed files with 4 additions and 1 deletions

View File

@ -149,8 +149,11 @@ struct fdisk_context *fdisk_new_nested_context(struct fdisk_context *parent,
fdisk_ref_context(parent);
cxt->parent = parent;
if (init_nested_from_parent(cxt, 1) != 0)
if (init_nested_from_parent(cxt, 1) != 0) {
cxt->parent = NULL;
fdisk_unref_context(cxt);
return NULL;
}
if (name) {
if (strcasecmp(name, "bsd") == 0)