From: Danny Al-Gaaf Date: Thu, 25 Jul 2013 22:14:59 +0000 (+0200) Subject: test_cls_version.cc: close some memory leaks X-Git-Tag: v0.67-rc3~41^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=143b843ed1aea72d4a21a659ffee37a751eb9610;p=ceph.git test_cls_version.cc: close some memory leaks 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 --- diff --git a/src/test/cls_version/test_cls_version.cc b/src/test/cls_version/test_cls_version.cc index acce4f00cf4c..4c2d59500df9 100644 --- a/src/test/cls_version/test_cls_version.cc +++ b/src/test/cls_version/test_cls_version.cc @@ -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));