]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/rados/list.cc: Memory leak in ceph_test_rados_api_list
authorBrad Hubbard <bhubbard@redhat.com>
Wed, 14 Dec 2016 04:01:32 +0000 (14:01 +1000)
committerBrad Hubbard <bhubbard@redhat.com>
Wed, 14 Dec 2016 22:20:27 +0000 (08:20 +1000)
Valgrind flags a memory leak when we create a temporary from
rados_object_list_end()

Fixes: http://tracker.ceph.com/issues/18250
Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
src/test/librados/list.cc

index a90c7d3214b059cad078956591f401b134f49ef8..e250be34aea8abaf7f072004e18e7d236aeb4aaf 100644 (file)
@@ -692,9 +692,10 @@ TEST_F(LibRadosList, EnumerateObjects) {
   {
     rados_object_list_item results[12];
     memset(results, 0, sizeof(rados_object_list_item) * 12);
-    int r = rados_object_list(ioctx,
-            c, rados_object_list_end(ioctx),
+    rados_object_list_cursor temp_end = rados_object_list_end(ioctx);
+    int r = rados_object_list(ioctx, c, temp_end,
             12, NULL, 0, results, &c);
+    rados_object_list_cursor_free(ioctx, temp_end);
     ASSERT_GE(r, 0);
     for (int i = 0; i < r; ++i) {
       std::string oid(results[i].oid, results[i].oid_length);