diff mbox

[1/5] btrfs-progs: check, fix path leak in error branch

Message ID 0665aaf5a3733c5153e7fc0959d813c6ff76ee34.1419951036.git.dsterba@suse.cz (mailing list archive)
State Accepted
Headers show

Commit Message

David Sterba Dec. 30, 2014, 2:57 p.m. UTC
Resolves-coverity-id: 1260250
Signed-off-by: David Sterba <dsterba@suse.cz>
---
 cmds-check.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/cmds-check.c b/cmds-check.c
index e74b116c0c43..71e4f4f3a13b 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -2839,7 +2839,7 @@  static int repair_btree(struct btrfs_root *root,
 		ret = PTR_ERR(trans);
 		fprintf(stderr, "Error starting transaction: %s\n",
 			strerror(-ret));
-		return ret;
+		goto out_free_path;
 	}
 	cache = first_cache_extent(corrupt_blocks);
 	while (cache) {
@@ -2894,8 +2894,9 @@  static int repair_btree(struct btrfs_root *root,
 		cache = next_cache_extent(cache);
 	}
 out:
-	btrfs_free_path(path);
 	btrfs_commit_transaction(trans, root);
+out_free_path:
+	btrfs_free_path(path);
 	return ret;
 }