diff options
author | Sunny Kumar <sunkumar@redhat.com> | 2018-12-04 00:18:42 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-12-05 03:49:14 +0000 |
commit | f479f4618923ca497d499dcaa533d19a2403e0b5 (patch) | |
tree | 7ae1cf63ebe07bc6475a59726e89c7da4890485a | |
parent | 82987486a9c9145caa6ce9ff31506ba2563a4a97 (diff) |
cli: fix memory leak in cli-cmd-system.c
This patch fixes memory leak reported by ASan.
SUMMARY: AddressSanitizer: 384 byte(s) leaked in 2 allocation(s).
updates: bz#1633930
Change-Id: I93ebddcfeea3d51547e00775db2c9d99f5dfafea
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
-rw-r--r-- | cli/src/cli-cmd-system.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/cli/src/cli-cmd-system.c b/cli/src/cli-cmd-system.c index 46ff926a2b8..8cd15424572 100644 --- a/cli/src/cli-cmd-system.c +++ b/cli/src/cli-cmd-system.c @@ -67,12 +67,13 @@ cli_cmd_getspec_cbk(struct cli_state *state, struct cli_cmd_word *word, out: if (!proc && ret) { - if (dict) - dict_unref(dict); if (wordcount > 1) cli_out("Fetching spec for volume %s failed", (char *)words[2]); } + if (dict) + dict_unref(dict); + return ret; } @@ -109,12 +110,12 @@ cli_cmd_pmap_b2p_cbk(struct cli_state *state, struct cli_cmd_word *word, out: if (!proc && ret) { - if (dict) - dict_unref(dict); if (wordcount > 1) cli_out("Fetching spec for volume %s failed", (char *)words[3]); } + if (dict) + dict_unref(dict); return ret; } @@ -322,6 +323,9 @@ out: cli_out("uuid get failed"); } + if (dict) + dict_unref(dict); + CLI_STACK_DESTROY(frame); return ret; } @@ -383,6 +387,9 @@ out: cli_out("uuid reset failed"); } + if (dict) + dict_unref(dict); + CLI_STACK_DESTROY(frame); return ret; |