| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | Re: [PATCH] xfs: fix two memory leaks in xfs_attr_list.c error paths |
| From: | Eric Sandeen <sandeen@xxxxxxxxxxx> |
| Date: | Wed, 10 Feb 2016 14:38:24 -0600 |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1455129337-19255-1-git-send-email-mguzik@xxxxxxxxxx> |
| References: | <1455129337-19255-1-git-send-email-mguzik@xxxxxxxxxx> |
| User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
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@xxxxxxxxxx>
> Cc: <stable@xxxxxxxxxxxxxxx>
Looks good (tho I wonder why coverity didn't spot...)
Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>
>
> ---
> 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,
>
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: richacl(7) man page review comments, J. Bruce Fields |
|---|---|
| Next by Date: | [PATCH v2 0/2] DAX bdev fixes - move flushing calls to FS, Ross Zwisler |
| Previous by Thread: | [PATCH] xfs: fix two memory leaks in xfs_attr_list.c error paths, Mateusz Guzik |
| Next by Thread: | Re: [PATCH] xfs: fix two memory leaks in xfs_attr_list.c error paths, Christoph Hellwig |
| Indexes: | [Date] [Thread] [Top] [All Lists] |