All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] libgfs2: Fix resource leak in lgfs2_lang_result()
Date: Tue, 02 Jul 2013 13:43:53 +0100	[thread overview]
Message-ID: <51D2CB09.6040903@redhat.com> (raw)
In-Reply-To: <1372767937-18869-1-git-send-email-pevans@redhat.com>

Hi Paul,

On 02/07/13 13:25, Paul Evans wrote:
> Spotted by coverity: Resource leak, variable "result" going out of scope
> and leaking the storage it points to.
>
> Variable "result" is now free'd before returning.
>
> Signed-off-by: Paul Evans <pevans@redhat.com>

Looks good to me.

> ---
>   gfs2/libgfs2/lang.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/gfs2/libgfs2/lang.c b/gfs2/libgfs2/lang.c
> index 28805b5..3cc5f29 100644
> --- a/gfs2/libgfs2/lang.c
> +++ b/gfs2/libgfs2/lang.c
> @@ -421,6 +421,7 @@ static struct lgfs2_lang_result *ast_interp_get(struct lgfs2_lang_state *state,
>   	} else if (ast->ast_right->ast_right->ast_type == AST_KW_STATE) {
>   		result->lr_blocknr = ast_lookup_block_num(ast->ast_right, sbd);
>   		if (result->lr_blocknr == 0) {
> +                        free(result);

Just a style nit: please use tabs for indentation and spaces for alignment.

Cheers,
Andy

>   			return NULL;
>   		}
>   		result->lr_state = ast_get_bitstate(result->lr_blocknr, sbd);
>



      reply	other threads:[~2013-07-02 12:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02 12:25 [Cluster-devel] [PATCH] libgfs2: Fix resource leak in lgfs2_lang_result() Paul Evans
2013-07-02 12:43 ` Andrew Price [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=51D2CB09.6040903@redhat.com \
    --to=anprice@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.