Skip to contentSkip to conversation

fix cmd->cmd_line memory pool use

PATCH New Milan Broz 2 participants 2 messages Apr 2, 2009

lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 1/1 fix cmd->cmd_line memory pool use

Do not use pointer from released memory pool (cmd->cmd_line).

---
 tools/lvmcmdline.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
tools/lvmcmdline.c +5 -5
index a96ef3c..bedf9e2 100644
@@ -1026,16 +1026,16 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
 	cmd->current_settings = cmd->default_settings;
 	_apply_settings(cmd);
 
-	/*
-	 * free off any memory the command used.
-	 */
-	dm_pool_empty(cmd->mem);
-
 	if (ret == EINVALID_CMD_LINE && !_cmdline.interactive)
 		_short_usage(cmd->command->name);
 
 	log_debug("Completed: %s", cmd->cmd_line);
 
+	/*
+	 * free off any memory the command used.
+	 */
+	dm_pool_empty(cmd->mem);
+
 	return ret;
 }
 
#1 lore raw

PATCH 1/1 fix cmd->cmd_line memory pool use

Quoted 1 line · Milan Broz

Do not use pointer from released memory pool (cmd->cmd_line).

Ack.

Alasdair

Signature · 1 line
agk at redhat.com