From: xie xingguo Date: Sun, 26 Jun 2016 03:37:47 +0000 (+0800) Subject: os/bluestore: fix memory leak during bit alloc ut X-Git-Tag: ses5-milestone5~557^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=06c48e410a2d51827e6c6edf81749e8f19252256;p=ceph.git os/bluestore: fix memory leak during bit alloc ut Signed-off-by: xie xingguo --- diff --git a/src/test/objectstore/BitAllocator_test.cc b/src/test/objectstore/BitAllocator_test.cc index 7364ea5fd2e3..17ad15369101 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)