]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: potential memory leak in FlushAioPP
authorZhiqiang Wang <zhiqiang.wang@intel.com>
Fri, 20 Mar 2015 08:15:42 +0000 (16:15 +0800)
committerZhiqiang Wang <zhiqiang.wang@intel.com>
Mon, 23 Mar 2015 03:26:07 +0000 (11:26 +0800)
Should call the release function instead of deleting it to free
librbd::RBD::AioCompletion and librbd::AioCompletion. Otherwise there is
a potential memory leak.

Signed-off-by: Zhiqiang Wang <zhiqiang.wang@intel.com>
src/test/librbd/test_librbd.cc

index 1d26485b5084c2be58ba8746658592e6db52c8ad..b25e96cc9b89c87edb5fc1c1d90afea8c4b4210a 100644 (file)
@@ -1962,12 +1962,12 @@ TEST_F(TestLibRBD, FlushAioPP)
     ASSERT_EQ(0, image.aio_flush(flush_comp));
     ASSERT_EQ(0, flush_comp->wait_for_complete());
     ASSERT_EQ(1, flush_comp->is_complete());
-    delete flush_comp;
+    flush_comp->release();
 
     for (i = 0; i < num_aios; ++i) {
       librbd::RBD::AioCompletion *comp = write_comps[i];
       ASSERT_EQ(1, comp->is_complete());
-      delete comp;
+      comp->release();
     }
     ASSERT_PASSED(validate_object_map, image);
   }