From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Rajnoha Date: Tue, 16 Apr 2013 10:47:12 +0200 Subject: [PATCH 7/7] config_def_check: Fix memory leak In-Reply-To: <1364852101-14961-7-git-send-email-tasleson@redhat.com> References: <1364852101-14961-1-git-send-email-tasleson@redhat.com> <1364852101-14961-7-git-send-email-tasleson@redhat.com> Message-ID: <516D1010.1070307@redhat.com> List-Id: To: lvm-devel@redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On 01.04.2013 23:35, Tony Asleson wrote: > There is no need to strdup a key when inserting into > the hash table as the table allocates memory and copies > the string. This was causing memory to be lost. > > Signed-off-by: Tony Asleson > --- > lib/config/config.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/config/config.c b/lib/config/config.c > index 009eb5f..2c77f30 100644 > --- a/lib/config/config.c > +++ b/lib/config/config.c > @@ -577,7 +577,7 @@ int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_ > cmd->cft_def_hash = NULL; > r = 0; goto out; > } > - dm_hash_insert(cmd->cft_def_hash, dm_strdup(vp), def); > + dm_hash_insert(cmd->cft_def_hash, vp, def); > } > } > > I've committed this one. Thanks for spotting it! Peter