summaryrefslogtreecommitdiff
path: root/lib/commands
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2012-03-12 14:15:04 +0000
committerZdenek Kabelac <zkabelac@redhat.com>2012-03-12 14:15:04 +0000
commitf6632c1ef42dfb4d16205fe59b9b501b6fb0ce33 (patch)
tree0f7d52e93be90929835dbeb4005ec1f85ee39f8a /lib/commands
parent2c2bb4a4587d1ef84171babdfae3ca4986e2c009 (diff)
downloadlvm2-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.c5
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;
}