Commit f9b3ef7e authored by Mateusz Guzik's avatar Mateusz Guzik Committed by Ben Hutchings

xfs: fix two memory leaks in xfs_attr_list.c error paths

commit 2e83b79b upstream.

This plugs 2 trivial leaks in xfs_attr_shortform_list and
xfs_attr3_leaf_list_int.
Signed-off-by: default avatarMateusz Guzik <mguzik@redhat.com>
Reviewed-by: default avatarEric Sandeen <sandeen@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 49c27d2f
...@@ -721,8 +721,10 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context) ...@@ -721,8 +721,10 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
sbp->namelen, sbp->namelen,
sbp->valuelen, sbp->valuelen,
&sbp->name[sbp->namelen]); &sbp->name[sbp->namelen]);
if (error) if (error) {
kmem_free(sbuf);
return error; return error;
}
if (context->seen_enough) if (context->seen_enough)
break; break;
cursor->offset++; cursor->offset++;
...@@ -2404,14 +2406,13 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context) ...@@ -2404,14 +2406,13 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
args.rmtblkno = be32_to_cpu(name_rmt->valueblk); args.rmtblkno = be32_to_cpu(name_rmt->valueblk);
args.rmtblkcnt = XFS_B_TO_FSB(args.dp->i_mount, valuelen); args.rmtblkcnt = XFS_B_TO_FSB(args.dp->i_mount, valuelen);
retval = xfs_attr_rmtval_get(&args); retval = xfs_attr_rmtval_get(&args);
if (retval) if (!retval)
return retval; retval = context->put_listent(context,
retval = context->put_listent(context, entry->flags,
entry->flags, name_rmt->name,
name_rmt->name, (int)name_rmt->namelen,
(int)name_rmt->namelen, valuelen,
valuelen, args.value);
args.value);
kmem_free(args.value); kmem_free(args.value);
} else { } else {
retval = context->put_listent(context, retval = context->put_listent(context,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment