Skip to content

Commit

Permalink
Btrfs: fix memory leak in start_transaction()
Browse files Browse the repository at this point in the history
Free btrfs_trans_handle when join_transaction() fails
in start_transaction()

Signed-off-by: Yoshinori Sano <yoshinori.sano@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Yoshinori Sano authored and Chris Mason committed Apr 5, 2011
1 parent 8b2b2d3 commit 6e8df2a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ static struct btrfs_trans_handle *start_transaction(struct btrfs_root *root,

ret = join_transaction(root);
if (ret < 0) {
kmem_cache_free(btrfs_trans_handle_cachep, h);
if (type != TRANS_JOIN_NOLOCK)
mutex_unlock(&root->fs_info->trans_mutex);
return ERR_PTR(ret);
Expand Down

0 comments on commit 6e8df2a

Please sign in to comment.