Btrfs: fix memory leak in btrfs_ioctl_start_sync()

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>
This commit is contained in:
Tsutomu Itoh 2011-04-04 01:52:13 +00:00 committed by Chris Mason
parent b44c59a80d
commit 8b2b2d3cbe
1 changed files with 3 additions and 1 deletions

View File

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