diff mbox

Btrfs: fix memory leak in btrfs_ioctl_start_sync()

Message ID 4D991A3B.9020805@jp.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tsutomu Itoh April 4, 2011, 1:09 a.m. UTC
Free btrfs_trans_handle if btrfs_commit_transaction_async() fails.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
---
 fs/btrfs/ioctl.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff -urNp linux-2.6.39-rc1/fs/btrfs/ioctl.c linux-2.6.39-rc1.new/fs/btrfs/ioctl.c
--- linux-2.6.39-rc1/fs/btrfs/ioctl.c	2011-03-30 04:09:47.000000000 +0900
+++ linux-2.6.39-rc1.new/fs/btrfs/ioctl.c	2011-04-04 09:52:17.000000000 +0900
@@ -2436,8 +2436,10 @@  static noinline long btrfs_ioctl_start_s
 		return PTR_ERR(trans);
 	transid = trans->transid;
 	ret = btrfs_commit_transaction_async(trans, root, 0);
-	if (ret)
+	if (ret) {
+		kmem_cache_free(btrfs_trans_handle_cachep, trans);
 		return ret;
+	}
 
 	if (argp)
 		if (copy_to_user(argp, &transid, sizeof(transid)))