summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMatthew Wilcox <mawilcox@microsoft.com>2017-01-29 01:52:55 -0500
committerMatthew Wilcox <mawilcox@microsoft.com>2017-02-13 21:44:07 -0500
commit6da0396cac7692b6667c09382a746593fff90e6d (patch)
treeea53cfb2caa296e7aa62eeff3238f8277cb19877 /tools
parent18d0c57394e42ff536e5fdc776b6b217fdd9889c (diff)
downloadlinux-6da0396cac7692b6667c09382a746593fff90e6d.tar.gz
linux-6da0396cac7692b6667c09382a746593fff90e6d.tar.bz2
linux-6da0396cac7692b6667c09382a746593fff90e6d.zip
radix tree test suite: Fix leaks in regression2.c
None of the malloc'ed data structures were ever being freed. Found with -fsanitize=address. Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com> Reviewed-by: Rehas Sachdeva <aquannie@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/radix-tree/regression2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/testing/radix-tree/regression2.c b/tools/testing/radix-tree/regression2.c
index a24d1beec7c8..42dd2a33ed24 100644
--- a/tools/testing/radix-tree/regression2.c
+++ b/tools/testing/radix-tree/regression2.c
@@ -103,7 +103,7 @@ void regression2_test(void)
/* 4. */
for (i = max_slots - 1; i >= 0; i--)
- radix_tree_delete(&mt_tree, i);
+ free(radix_tree_delete(&mt_tree, i));
/* 5. */
// NOTE: start should not be 0 because radix_tree_gang_lookup_tag_slot
@@ -114,7 +114,9 @@ void regression2_test(void)
PAGECACHE_TAG_TOWRITE);
/* We remove all the remained nodes */
- radix_tree_delete(&mt_tree, max_slots);
+ free(radix_tree_delete(&mt_tree, max_slots));
+
+ BUG_ON(!radix_tree_empty(&mt_tree));
printv(1, "regression test 2, done\n");
}