All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Rajnoha <prajnoha@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 7/7] config_def_check: Fix memory leak
Date: Tue, 16 Apr 2013 10:47:12 +0200	[thread overview]
Message-ID: <516D1010.1070307@redhat.com> (raw)
In-Reply-To: <1364852101-14961-7-git-send-email-tasleson@redhat.com>

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 <tasleson@redhat.com>
> ---
>  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



      reply	other threads:[~2013-04-16  8:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01 21:34 [PATCH 1/7] lvm2app: Implementation of pv resize (v6) Tony Asleson
2013-04-01 21:34 ` [PATCH 2/7] lvm2app: Move percent_of_extents to lvm-percent.[h|c] Tony Asleson
2013-04-01 21:34 ` [PATCH 3/7] lvm2app: Rework argument handling for lv resize Tony Asleson
2013-04-01 21:34 ` [PATCH 4/7] lvm2app: Move core lv re-size code (v2) Tony Asleson
2013-04-01 21:34 ` [PATCH 5/7] lvm2app: Implement lv resize (v2) Tony Asleson
2013-04-01 21:35 ` [PATCH 6/7] lvm2app: Add function to retrieve list of PVs Tony Asleson
2013-04-01 21:35 ` [PATCH 7/7] config_def_check: Fix memory leak Tony Asleson
2013-04-16  8:47   ` Peter Rajnoha [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=516D1010.1070307@redhat.com \
    --to=prajnoha@redhat.com \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.