diff options
author | Karel Zak | 2015-01-28 15:05:14 +0100 |
---|---|---|
committer | Karel Zak | 2015-01-28 15:05:14 +0100 |
commit | 9c321dfbf0f63a2070013dd1b58bdee37f5ac4aa (patch) | |
tree | 6f3e5176052d4ec8a601e2c1c3f7b13b06f539e0 /libfdisk/src/context.c | |
parent | libblkid: (hfs) avoid overflow [coverity scan] (diff) | |
download | kernel-qcow2-util-linux-9c321dfbf0f63a2070013dd1b58bdee37f5ac4aa.tar.gz kernel-qcow2-util-linux-9c321dfbf0f63a2070013dd1b58bdee37f5ac4aa.tar.xz kernel-qcow2-util-linux-9c321dfbf0f63a2070013dd1b58bdee37f5ac4aa.zip |
libfdisk: fix possible mem leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/context.c')
-rw-r--r-- | libfdisk/src/context.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c index ef8b30b04..84867b0ab 100644 --- a/libfdisk/src/context.c +++ b/libfdisk/src/context.c @@ -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) |