Btrfs: fix memory leak in btrfs_ioctl_start_sync()
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>
Mon, 4 Apr 2011 01:52:13 +0000 (01:52 +0000)
committerChris Mason <chris.mason@oracle.com>
Tue, 5 Apr 2011 05:19:42 +0000 (01:19 -0400)
Call btrfs_end_transaction() if btrfs_commit_transaction_async() fails.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ioctl.c

index 6b70e0e2bd1e224dd0bdcaf72d9a86f55e2944c2..255c7c5279c4a245f5d401b8b283539895b03d18 100644 (file)
@@ -2436,8 +2436,10 @@ static noinline long btrfs_ioctl_start_sync(struct file *file, void __user *argp
                return PTR_ERR(trans);
        transid = trans->transid;
        ret = btrfs_commit_transaction_async(trans, root, 0);
-       if (ret)
+       if (ret) {
+               btrfs_end_transaction(trans, root);
                return ret;
+       }
 
        if (argp)
                if (copy_to_user(argp, &transid, sizeof(transid)))