The seen cache_tree in run_next_block freed.
Originally, this "missing" causes memory leaks, reported by valgrind.

Signed-off-by: Gui Hecheng <guihc.f...@cn.fujitsu.com>
---
 cmds-check.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/cmds-check.c b/cmds-check.c
index 6cbd5a6..0cba4cc 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -3595,6 +3595,11 @@ static int run_next_block(struct btrfs_root *root,
                remove_cache_extent(nodes, cache);
                free(cache);
        }
+       cache = lookup_cache_extent(seen, bytenr, size);
+       if (cache) {
+               remove_cache_extent(seen, cache);
+               free(cache);
+       }
 
        /* fixme, get the real parent transid */
        buf = read_tree_block(root, bytenr, size, 0);
-- 
1.8.0.1

--
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