]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: potential memory leak in FlushAioPP 5280/head
authorZhiqiang Wang <zhiqiang.wang@intel.com>
Fri, 20 Mar 2015 08:15:42 +0000 (16:15 +0800)
committerJason Dillaman <dillaman@redhat.com>
Fri, 17 Jul 2015 18:17:04 +0000 (14:17 -0400)
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>
(cherry picked from commit ada7ec860cb7901c560c12a5af36dc7c23051b76)

src/test/librbd/test_librbd.cc

index b4ad6ca851d2eaf4ee8c4f4a9420ade2ebb6430e..2f2082660dd1d1a333f57018d5295b314e143037 100644 (file)
@@ -1975,12 +1975,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);
   }