From: Eric Sandeen <sandeen@sandeen.net>
To: xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: fix two memory leaks in xfs_attr_list.c error paths
Date: Wed, 10 Feb 2016 14:38:24 -0600 [thread overview]
Message-ID: <56BB9FC0.1080202@sandeen.net> (raw)
In-Reply-To: <1455129337-19255-1-git-send-email-mguzik@redhat.com>
On 2/10/16 12:35 PM, Mateusz Guzik wrote:
> This plugs 2 trivial leaks in xfs_attr_shortform_list and
> xfs_attr3_leaf_list_int.
>
> Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
> Cc: <stable@vger.kernel.org>
Looks good (tho I wonder why coverity didn't spot...)
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
>
> ---
> fs/xfs/xfs_attr_list.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
> index 0ef7c2e..4fa1482 100644
> --- a/fs/xfs/xfs_attr_list.c
> +++ b/fs/xfs/xfs_attr_list.c
> @@ -202,8 +202,10 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
> sbp->namelen,
> sbp->valuelen,
> &sbp->name[sbp->namelen]);
> - if (error)
> + if (error) {
> + kmem_free(sbuf);
> return error;
> + }
> if (context->seen_enough)
> break;
> cursor->offset++;
> @@ -454,14 +456,13 @@ xfs_attr3_leaf_list_int(
> args.rmtblkcnt = xfs_attr3_rmt_blocks(
> args.dp->i_mount, valuelen);
> retval = xfs_attr_rmtval_get(&args);
> - if (retval)
> - return retval;
> - retval = context->put_listent(context,
> - entry->flags,
> - name_rmt->name,
> - (int)name_rmt->namelen,
> - valuelen,
> - args.value);
> + if (!retval)
> + retval = context->put_listent(context,
> + entry->flags,
> + name_rmt->name,
> + (int)name_rmt->namelen,
> + valuelen,
> + args.value);
> kmem_free(args.value);
> } else {
> retval = context->put_listent(context,
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-02-10 20:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-10 18:35 [PATCH] xfs: fix two memory leaks in xfs_attr_list.c error paths Mateusz Guzik
2016-02-10 20:38 ` Eric Sandeen [this message]
2016-02-12 9:27 ` Christoph Hellwig
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=56BB9FC0.1080202@sandeen.net \
--to=sandeen@sandeen.net \
--cc=xfs@oss.sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox