Skip to content

Commit 6e8df2a

Browse files
yoshinorisanochrismason-xx
authored andcommitted
Btrfs: fix memory leak in start_transaction()
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>
1 parent 8b2b2d3 commit 6e8df2a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/transaction.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ static struct btrfs_trans_handle *start_transaction(struct btrfs_root *root,
197197

198198
ret = join_transaction(root);
199199
if (ret < 0) {
200+
kmem_cache_free(btrfs_trans_handle_cachep, h);
200201
if (type != TRANS_JOIN_NOLOCK)
201202
mutex_unlock(&root->fs_info->trans_mutex);
202203
return ERR_PTR(ret);

0 commit comments

Comments
 (0)