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 /lib/commands | |
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 'lib/commands')
-rw-r--r-- | lib/commands/toolcontext.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index da7285db9..23617829b 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -1371,6 +1371,11 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived, cmd->config_valid = 1; out: + if (cmd->config_valid != 1) { + destroy_toolcontext(cmd); + cmd = NULL; + } + return cmd; } |