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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Resolves-coverity-id: 1260250
Signed-off-by: David Sterba <dsterba@xxxxxxx>
---
 cmds-check.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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

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



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux