Skip to contentSkip to conversation

master - commands: fix memleak

PATCH Zdenek Kabelac 1 participant 1 message Feb 19, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2a21a19d904c34e56e3ab3fe026dbc5658f68925
Commit:        2a21a19d904c34e56e3ab3fe026dbc5658f68925
Parent:        87c89ac2791e9b443db8c009db67610cbd97b4f2
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sat Feb 18 18:49:19 2017 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Sun Feb 19 22:59:43 2017 +0100

commands: fix memleak

Keep all allocations 'mempool' allocated for simple cleanup.

---
 tools/lvmcmdline.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/lvmcmdline.c +1 -1
index 26f7476..c304602 100644
@@ -2519,7 +2519,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
 	/* each command should start out with sigint flag cleared */
 	sigint_clear();
 
-	cmd->name = strdup(argv[0]);
+	cmd->name = dm_pool_strdup(cmd->mem, argv[0]);
 
 	/* eliminate '-' from all options starting with -- */
 	for (i = 1; i < argc; i++) {