From 06c48e410a2d51827e6c6edf81749e8f19252256 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Sun, 26 Jun 2016 11:37:47 +0800 Subject: [PATCH] os/bluestore: fix memory leak during bit alloc ut Signed-off-by: xie xingguo --- src/test/objectstore/BitAllocator_test.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/test/objectstore/BitAllocator_test.cc b/src/test/objectstore/BitAllocator_test.cc index 7364ea5fd2e34..17ad153691017 100644 --- a/src/test/objectstore/BitAllocator_test.cc +++ b/src/test/objectstore/BitAllocator_test.cc @@ -84,7 +84,6 @@ TEST(BitAllocator, test_bmap_iter) bmap_test_assert(count == num_items + 1); delete arr; - //delete list; num_items = 4; off = num_items - 1; @@ -93,7 +92,6 @@ TEST(BitAllocator, test_bmap_iter) for (i = 0; i < num_items; i++) { (*arr)[i].init(i); } -// list = new BitMapList(arr, num_items, 0); iter = BitMapEntityIter(arr, off, true); i = off; last_idx = off; @@ -109,6 +107,8 @@ TEST(BitAllocator, test_bmap_iter) bmap_test_assert(i == (off + 1)%num_items); bmap_test_assert(count == num_items + 1); + delete arr; + /* * BitMapArea Iter tests. */ @@ -136,7 +136,6 @@ TEST(BitAllocator, test_bmap_iter) bmap_test_assert(i == off); bmap_test_assert(count == num_items); - // offset 0 off = 0; area_iter = BmapEntityListIter(area_list, off, true); i = off; @@ -152,6 +151,12 @@ TEST(BitAllocator, test_bmap_iter) } bmap_test_assert(i == (off + 1)%num_items); bmap_test_assert(count == num_items + 1); + + for (i = 0; i < num_items; i++) + delete children[i]; + + delete children; + delete area_list; } TEST(BitAllocator, test_bmap_entry) @@ -232,6 +237,7 @@ TEST(BitAllocator, test_bmap_entry) bmap_test_assert(!bmap->is_allocated(0, 4)); bmap->set_bits(0, 4); bmap_test_assert(bmap->is_allocated(0, BmapEntry::size())); + delete bmap; } TEST(BitAllocator, test_zone_alloc) -- 2.39.5