From: Danny Al-Gaaf Date: Sat, 1 Mar 2014 10:36:18 +0000 (+0100) Subject: c_write_operations.cc: fix some ioctx resource leaks X-Git-Tag: v0.78~108^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ad9b6d2f7a0220354b28645ae15fbb7ed734c87c;p=ceph.git c_write_operations.cc: fix some ioctx resource leaks CID 1160833 (#3 of 3): Resource leak (RESOURCE_LEAK) leaked_storage: Variable "ioctx" going out of scope leaks the storage it points to CID 1160835 (#3 of 3): Resource leak (RESOURCE_LEAK) leaked_storage: Variable "ioctx" going out of scope leaks the storage it points to. CID 1188156 (#5 of 5): Resource leak (RESOURCE_LEAK) leaked_storage: Variable "ioctx" going out of scope leaks the storage it points to. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/test/librados/c_write_operations.cc b/src/test/librados/c_write_operations.cc index d511172e2f03..4dede36a3679 100644 --- a/src/test/librados/c_write_operations.cc +++ b/src/test/librados/c_write_operations.cc @@ -73,6 +73,7 @@ TEST(LibRadosCWriteOps, Xattrs) { ASSERT_EQ(-125, rados_write_op_operate(op, ioctx, "test", NULL, 0)); rados_release_write_op(op); + rados_ioctx_destroy(ioctx); ASSERT_EQ(0, destroy_one_pool(pool_name, &cluster)); } @@ -113,6 +114,7 @@ TEST(LibRadosCWriteOps, Write) { ASSERT_EQ(-2, rados_read(ioctx, "test", hi, 4, 0)); rados_release_write_op(op); + rados_ioctx_destroy(ioctx); ASSERT_EQ(0, destroy_one_pool(pool_name, &cluster)); } @@ -135,5 +137,6 @@ TEST(LibRadosCWriteOps, Exec) { hi[12] = '\0'; ASSERT_EQ(0, strcmp("Hello, test!", hi)); + rados_ioctx_destroy(ioctx); ASSERT_EQ(0, destroy_one_pool(pool_name, &cluster)); }