diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2012-03-12 14:15:04 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2012-03-12 14:15:04 +0000 |
commit | f6632c1ef42dfb4d16205fe59b9b501b6fb0ce33 (patch) | |
tree | 0f7d52e93be90929835dbeb4005ec1f85ee39f8a /tools/lvmcmdline.c | |
parent | 2c2bb4a4587d1ef84171babdfae3ca4986e2c009 (diff) | |
download | lvm2-f6632c1ef42dfb4d16205fe59b9b501b6fb0ce33.tar.gz |
Fix error path for create_toolcontext
Never return unfinished toolcontext - since error path is hit on
various stages of initialization we cannot leave it partially uninitialized,
since we would need to spread many more test across the code for config_valid.
Instead return NULL and properly release udev library resources as well.
Diffstat (limited to 'tools/lvmcmdline.c')
-rw-r--r-- | tools/lvmcmdline.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 6efd08246..48c65015a 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -1248,13 +1248,16 @@ struct cmd_context *init_lvm(void) if (!udev_init_library_context()) stack; - if (!(cmd = create_toolcontext(0, NULL, 1, 0))) + if (!(cmd = create_toolcontext(0, NULL, 1, 0))) { + udev_fin_library_context(); return_NULL; + } _cmdline.arg_props = &_arg_props[0]; if (stored_errno()) { destroy_toolcontext(cmd); + udev_fin_library_context(); return_NULL; } |