btrfs-progs: check, fix path leak in error branch

Resolves-coverity-id: 1260250
Signed-off-by: David Sterba <dsterba@suse.cz>
master
David Sterba 2014-12-30 14:52:55 +01:00
parent d4ef1a06f8
commit 0665aaf5a3
1 changed files with 3 additions and 2 deletions

View File

@ -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;
}