From: Zdenek Kabelac Date: Thu, 30 Sep 2010 11:44:54 +0000 (+0000) Subject: Fix memory leak of config_tree X-Git-Tag: v2_02_91~1532 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=3d7e8602ed83a40a624aba8a1c45aa8394b4316c;p=lvm2.git Fix memory leak of config_tree Adding missing destroy_config_tree() for cft_override if it has been allocated. --- diff --git a/WHATS_NEW b/WHATS_NEW index ca460a7a1..4dde8a57c 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.75 - ===================================== + Fix memory leak of config_tree in reinitialization code path. Swap pool destruction order in dmeventd_lvm2_exit() to fix leak report. Read whole /proc/self/maps file before working with maps entries. Speed up unquoting of quoted double quotes and backslashes. diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 6c66fab6f..b29acfbb2 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -1048,6 +1048,10 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv) if (arg_count(cmd, config_ARG) || !cmd->config_valid || config_files_changed(cmd)) { /* Reinitialise various settings inc. logging, filters */ if (!refresh_toolcontext(cmd)) { + if (cmd->cft_override) { + destroy_config_tree(cmd->cft_override); + cmd->cft_override = NULL; + } log_error("Updated config file invalid. Aborting."); return ECMD_FAILED; }