This was found by static analysis.

Signed-off-by: Zach Brown <z...@redhat.com>
---
 cmds-check.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index ebba58e..b6035d7 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -3228,13 +3228,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;
@@ -3274,6 +3274,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 &&
-- 
1.7.11.7

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

Reply via email to