From: Miao Xie Date: Thu, 20 Sep 2012 04:14:29 +0000 (-0600) Subject: Btrfs: fix memory leak in start_transaction() X-Git-Tag: v3.7-rc3~21^2~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8830e606ffee383f073e32313f11fc5692813fe;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git Btrfs: fix memory leak in start_transaction() This patch fixes memory leak of the transaction handle which happened when starting transaction failed on a freezed fs. Signed-off-by: Miao Xie --- diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 910ff80..3548964 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -351,8 +351,10 @@ again: */ if (type != TRANS_JOIN_NOLOCK && !__sb_start_write(root->fs_info->sb, SB_FREEZE_FS, false)) { - if (type == TRANS_JOIN_FREEZE) + if (type == TRANS_JOIN_FREEZE) { + kmem_cache_free(btrfs_trans_handle_cachep, h); return ERR_PTR(-EPERM); + } sb_start_intwrite(root->fs_info->sb); }