]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fix memory leak during bit alloc ut
authorxie xingguo <xie.xingguo@zte.com.cn>
Sun, 26 Jun 2016 03:37:47 +0000 (11:37 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 29 Jun 2016 04:43:32 +0000 (12:43 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/test/objectstore/BitAllocator_test.cc

index 7364ea5fd2e3495ac2228609d04547f06ab6e1d8..17ad153691017ea722b7e7c6fef136074b084a9a 100644 (file)
@@ -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<BmapEntityTmp>(arr, num_items, 0);
   iter = BitMapEntityIter<BmapEntityTmp>(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)