From 7dff2d3a1f54fe4f519aa804f1935d02fafa5a3e Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 7 Oct 2013 14:43:01 -0700 Subject: [PATCH] btrfs-progs: don't leak path in verify_space_cache This was found by static analysis. Signed-off-by: Zach Brown Reviewed-by: chandan Signed-off-by: Chris Mason --- cmds-check.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index d353571..668af15 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -3294,13 +3294,13 @@ static int verify_space_cache(struct btrfs_root *root, ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); if (ret < 0) - return ret; + goto out; ret = 0; while (1) { if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) { ret = btrfs_next_leaf(root, path); if (ret < 0) - return ret; + goto out; if (ret > 0) { ret = 0; break; @@ -3340,6 +3340,8 @@ static int verify_space_cache(struct btrfs_root *root, ret = check_cache_range(root, cache, last, cache->key.objectid + cache->key.offset - last); + +out: btrfs_free_path(path); if (!ret && -- 2.7.4