There are 2 known extent buffer:
1) With -t option.
-t option will skip other tree roots, but it will read the root node
first and then skip it.
Where it forgets to free the tree block it read.

2) with -b option.
It forgets to free the tree block it read.

Signed-off-by: Qu Wenruo <[email protected]>
---
 btrfs-debug-tree.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/btrfs-debug-tree.c b/btrfs-debug-tree.c
index ce7a792..610624e 100644
--- a/btrfs-debug-tree.c
+++ b/btrfs-debug-tree.c
@@ -221,6 +221,7 @@ int main(int ac, char **av)
                        goto close_root;
                }
                btrfs_print_tree(root, leaf, 0);
+               free_extent_buffer(leaf);
                goto close_root;
        }
 
@@ -284,8 +285,10 @@ again:
                                              0);
                        if (!extent_buffer_uptodate(buf))
                                goto next;
-                       if (tree_id && found_key.objectid != tree_id)
+                       if (tree_id && found_key.objectid != tree_id) {
+                               free_extent_buffer(buf);
                                goto next;
+                       }
 
                        switch(found_key.objectid) {
                        case BTRFS_ROOT_TREE_OBJECTID:
-- 
2.3.0

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

Reply via email to