]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
c_write_operations.cc: fix some ioctx resource leaks
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sat, 1 Mar 2014 10:36:18 +0000 (11:36 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sat, 1 Mar 2014 10:36:18 +0000 (11:36 +0100)
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 <danny.al-gaaf@bisect.de>
src/test/librados/c_write_operations.cc

index d511172e2f0343e0e70342f8097cc62e8e5b7476..4dede36a36792e7e7f3b1c65a68b48e77df70218 100644 (file)
@@ -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));
 }