summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2014-11-26 11:46:13 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2014-11-26 11:46:13 +0100
commit193f9b26a0a87b2f5ce9a308ea0d957fadfe4aeb (patch)
treef722e11f12c167319dbe3f8231c01b8dcc03405f
parent86ae68a5f7e396a6584b8003667b44a433d914fd (diff)
downloadlvm2-193f9b26a0a87b2f5ce9a308ea0d957fadfe4aeb.tar.gz
coverity: fix possible NULL dereference
The call to dm_config_destroy can derefence result->mem while result is still NULL: struct dm_config_tree *get_cachepolicy_params(struct cmd_context *cmd) { ... int ok = 0; ... if (!(result = dm_config_flatten(current))) goto_out; ... ok = 1; out: if (!ok) { dm_config_destroy(result) ... } ... }
-rw-r--r--tools/toollib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/toollib.c b/tools/toollib.c
index ddf2dcffc..71eb9a879 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1175,7 +1175,7 @@ struct dm_config_tree *get_cachepolicy_params(struct cmd_context *cmd)
ok = 1;
out:
- if (!ok) {
+ if (!ok && result) {
dm_config_destroy(result);
result = NULL;
}