diff options
author | Mateusz Guzik <mguzik@redhat.com> | 2016-03-01 17:51:09 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-03-01 17:51:09 -0500 |
commit | 2e83b79b2d6c78bf1b4aa227938a214dcbddc83f (patch) | |
tree | c8c9f4316f17836a4ed383dfd2fea2b2794d3700 | |
parent | 36f90b0a2ddd60823fe193a85e60ff1906c2a9b3 (diff) |
xfs: fix two memory leaks in xfs_attr_list.c error paths
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>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r-- | fs/xfs/xfs_attr_list.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c index 0ef7c2ed3f8a..4fa14820e2e2 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) | |||
202 | sbp->namelen, | 202 | sbp->namelen, |
203 | sbp->valuelen, | 203 | sbp->valuelen, |
204 | &sbp->name[sbp->namelen]); | 204 | &sbp->name[sbp->namelen]); |
205 | if (error) | 205 | if (error) { |
206 | kmem_free(sbuf); | ||
206 | return error; | 207 | return error; |
208 | } | ||
207 | if (context->seen_enough) | 209 | if (context->seen_enough) |
208 | break; | 210 | break; |
209 | cursor->offset++; | 211 | cursor->offset++; |
@@ -454,14 +456,13 @@ xfs_attr3_leaf_list_int( | |||
454 | args.rmtblkcnt = xfs_attr3_rmt_blocks( | 456 | args.rmtblkcnt = xfs_attr3_rmt_blocks( |
455 | args.dp->i_mount, valuelen); | 457 | args.dp->i_mount, valuelen); |
456 | retval = xfs_attr_rmtval_get(&args); | 458 | retval = xfs_attr_rmtval_get(&args); |
457 | if (retval) | 459 | if (!retval) |
458 | return retval; | 460 | retval = context->put_listent(context, |
459 | retval = context->put_listent(context, | 461 | entry->flags, |
460 | entry->flags, | 462 | name_rmt->name, |
461 | name_rmt->name, | 463 | (int)name_rmt->namelen, |
462 | (int)name_rmt->namelen, | 464 | valuelen, |
463 | valuelen, | 465 | args.value); |
464 | args.value); | ||
465 | kmem_free(args.value); | 466 | kmem_free(args.value); |
466 | } else { | 467 | } else { |
467 | retval = context->put_listent(context, | 468 | retval = context->put_listent(context, |