]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: fix memory leaks in rbd-mirror test cases 8493/head
authorJason Dillaman <dillaman@redhat.com>
Thu, 7 Apr 2016 20:40:45 +0000 (16:40 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 7 Apr 2016 20:40:45 +0000 (16:40 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/rbd_mirror/test_ImageReplayer.cc
src/test/rbd_mirror/test_ImageSync.cc

index 10310f1d70c88b2aa7911861202a9f5f0d524b56..84e4afc22a4f53d8363bba46f48928bb0f00a7df 100644 (file)
@@ -104,6 +104,13 @@ public:
 
   ~TestImageReplayer()
   {
+    if (m_watch_handle != 0) {
+      m_remote_ioctx.unwatch2(m_watch_handle);
+      delete m_watch_ctx;
+      m_watch_ctx = nullptr;
+      m_watch_handle = 0;
+    }
+
     delete m_replayer;
     delete m_threads;
 
index e9b234e7db94dde00867f1293c1dd2f2cb13d9e5..5e6b0a9d310156436f4a1641b86f2a8f34ed9122 100644 (file)
@@ -58,6 +58,11 @@ public:
     ASSERT_EQ(0, m_remote_journaler->register_client(client_data_bl));
   }
 
+  virtual void TearDown() {
+    TestFixture::TearDown();
+    delete m_remote_journaler;
+  }
+
   void create_and_open(librados::IoCtx &io_ctx, librbd::ImageCtx **image_ctx) {
     librbd::RBD rbd;
     ASSERT_EQ(0, create_image(rbd, io_ctx, m_image_name, m_image_size));