aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2014-01-15 15:07:06 +0000
committerDavid Howells <dhowells@redhat.com>2014-01-15 15:07:06 +0000
commitf36abed25446e8ce56f7b6316cbd9ca49b925072 (patch)
tree30a9d3bc0f5d3a8a3f455127dde481d482abdc52
parent47cf4085c2525c8a15607b5ae0726cde0f3ec413 (diff)
downloadkeyutils-f36abed25446e8ce56f7b6316cbd9ca49b925072.tar.gz
Fix memory leak in dump_key_tree_aux() in the keyctl program
Fix a leak of the description string memory from each key visited in dump_key_tree_aux() in the keyctl program. Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--keyctl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/keyctl.c b/keyctl.c
index f99f90e..729a62a 100644
--- a/keyctl.c
+++ b/keyctl.c
@@ -1735,6 +1735,8 @@ static int dump_key_tree_aux(key_serial_t key, int depth, int more, int hex_key_
depth > 0 ? "\\_ " : "",
type, desc + dpos);
+ free(desc);
+
/* if it's a keyring then we're going to want to recursively
* display it if we can */
if (strcmp(type, "keyring") == 0) {
@@ -1793,7 +1795,6 @@ static int dump_key_tree_aux(key_serial_t key, int depth, int more, int hex_key_
free(payload);
}
- free(desc);
return kcount;
} /* end dump_key_tree_aux() */