summaryrefslogtreecommitdiff
path: root/root-tree.c
diff options
context:
space:
mode:
authorRakesh Pandit <rakesh@tuxera.com>2014-02-28 19:27:06 +0200
committerChris Mason <clm@fb.com>2014-03-21 06:23:32 -0700
commit31afed36899169cdb22c8bba16f8075aeae4007f (patch)
tree04cd43a50007cb92d9ecc07f8df15d6f84f9ea65 /root-tree.c
parentb5fe148715ea295e2b951ec6c90409b9d81978d8 (diff)
downloadbtrfs-progs-31afed36899169cdb22c8bba16f8075aeae4007f.tar.gz
Btrfs-progs: free path if we don't find root item
In btrfs_find_last_root before returning with -ENOENT (if root item is not found) free path and also remove btrfs_release_path before btrfs_free_path because btrfs_free_path anyway calls it. Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'root-tree.c')
-rw-r--r--root-tree.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/root-tree.c b/root-tree.c
index 858fe2f..934d02e 100644
--- a/root-tree.c
+++ b/root-tree.c
@@ -40,8 +40,10 @@ int btrfs_find_last_root(struct btrfs_root *root, u64 objectid,
ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0);
if (ret < 0)
goto out;
- if (path->slots[0] == 0)
- return -ENOENT;
+ if (path->slots[0] == 0) {
+ ret = -ENOENT;
+ goto out;
+ }
BUG_ON(ret == 0);
l = path->nodes[0];
@@ -56,7 +58,6 @@ int btrfs_find_last_root(struct btrfs_root *root, u64 objectid,
memcpy(key, &found_key, sizeof(found_key));
ret = 0;
out:
- btrfs_release_path(path);
btrfs_free_path(path);
return ret;
}
@@ -120,7 +121,6 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
write_extent_buffer(l, item, ptr, sizeof(*item));
btrfs_mark_buffer_dirty(path->nodes[0]);
out:
- btrfs_release_path(path);
btrfs_free_path(path);
return ret;
}