Skip to content

Commit

Permalink
c_write_operations.cc: fix some ioctx resource leaks
Browse files Browse the repository at this point in the history
CID 1160833 (ceph#3 of 3): Resource leak (RESOURCE_LEAK)
 leaked_storage: Variable "ioctx" going out of scope leaks the storage
 it points to

CID 1160835 (ceph#3 of 3): Resource leak (RESOURCE_LEAK)
 leaked_storage: Variable "ioctx" going out of scope leaks the storage
 it points to.

CID 1188156 (ceph#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 <[email protected]>
  • Loading branch information
dalgaaf committed Mar 1, 2014
1 parent e8533ee commit ad9b6d2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/test/librados/c_write_operations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down Expand Up @@ -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));
}

Expand All @@ -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));
}

0 comments on commit ad9b6d2

Please sign in to comment.