]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test_cls_version.cc: close some memory leaks
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 25 Jul 2013 22:14:59 +0000 (00:14 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 26 Jul 2013 21:55:41 +0000 (23:55 +0200)
Close some memory leaks caused by calling new() without
freeing the memory already assigned to 'rop'.

CID 1054848 (#1-6 of 6): Resource leak (RESOURCE_LEAK)
  overwrite_var: Overwriting "rop" in "rop = new_rop()"
  leaks the storage that "rop" points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/test/cls_version/test_cls_version.cc

index acce4f00cf4c57ebbe80841d58d3175a353b7396..4c2d59500df9b29a5e8d4b88a5c690e4b16bd391 100644 (file)
@@ -270,14 +270,17 @@ TEST(cls_rgw, test_version_inc_check)
   bufferlist bl;
   ASSERT_EQ(0, ioctx.operate(oid, rop, &bl));
 
+  delete rop;
   rop = new_rop();
   cls_version_check(*rop, cond_ver, VER_COND_GE);
   ASSERT_EQ(0, ioctx.operate(oid, rop, &bl));
 
+  delete rop;
   rop = new_rop();
   cls_version_check(*rop, cond_ver, VER_COND_LE);
   ASSERT_EQ(0, ioctx.operate(oid, rop, &bl));
 
+  delete rop;
   rop = new_rop();
   cls_version_check(*rop, cond_ver, VER_COND_TAG_EQ);
   ASSERT_EQ(0, ioctx.operate(oid, rop, &bl));
@@ -296,14 +299,17 @@ TEST(cls_rgw, test_version_inc_check)
   delete op;
 
   /* a bunch of conditions that should fail */
+  delete rop;
   rop = new_rop();
   cls_version_check(*rop, ver, VER_COND_LT);
   ASSERT_EQ(-ECANCELED, ioctx.operate(oid, rop, &bl));
 
+  delete rop;
   rop = new_rop();
   cls_version_check(*rop, cond_ver, VER_COND_LE);
   ASSERT_EQ(-ECANCELED, ioctx.operate(oid, rop, &bl));
 
+  delete rop;
   rop = new_rop();
   cls_version_check(*rop, cond_ver, VER_COND_TAG_NE);
   ASSERT_EQ(-ECANCELED, ioctx.operate(oid, rop, &bl));