All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Thomas Jarosch <thomas.jarosch@intra2net.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: [mdadm PATCH] Fix small memory leak
Date: Mon, 3 Oct 2011 08:31:27 +1100	[thread overview]
Message-ID: <20111003083127.039bc0fe@notabene.brown> (raw)
In-Reply-To: <4E88BF65.2010500@intra2net.com>

[-- Attachment #1: Type: text/plain, Size: 958 bytes --]

On Sun, 02 Oct 2011 21:45:41 +0200 Thomas Jarosch
<thomas.jarosch@intra2net.com> wrote:

> Credit goes to cppcheck.
> 
> Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
> ---
>  policy.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/policy.c b/policy.c
> index 2bbbac8..4a6ef82 100644
> --- a/policy.c
> +++ b/policy.c
> @@ -757,8 +757,10 @@ int policy_check_path(struct mdinfo *disk, struct map_ent *array)
>  
>  	snprintf(path, PATH_MAX, FAILED_SLOTS_DIR "/%s", id_path);
>  	f = fopen(path, "r");
> -	if (!f)
> +	if (!f) {
> +		free(id_path);
>  		return 0;
> +	}
>  
>  	rv = fscanf(f, " %s %x:%x:%x:%x\n",
>  		    array->metadata,
> @@ -767,6 +769,7 @@ int policy_check_path(struct mdinfo *disk, struct map_ent *array)
>  		    array->uuid+2,
>  		    array->uuid+3);
>  	fclose(f);
> +	free(id_path);
>  	return rv == 5;
>  }
>  


applied.  Thanks.

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

  reply	other threads:[~2011-10-02 21:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-02 19:45 [mdadm PATCH] Fix small memory leak Thomas Jarosch
2011-10-02 21:31 ` NeilBrown [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-26  5:33 Thomas Jarosch
2011-09-07  8:11 ` NeilBrown

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=20111003083127.039bc0fe@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=thomas.jarosch@intra2net.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.