]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: Memory leaks in object_list_begin and object_list_end 12482/head
authorBrad Hubbard <bhubbard@redhat.com>
Wed, 14 Dec 2016 06:29:08 +0000 (16:29 +1000)
committerBrad Hubbard <bhubbard@redhat.com>
Wed, 14 Dec 2016 06:29:08 +0000 (16:29 +1000)
We allocate a cursor in the constructor but simply reassign it in these
functions without cleaning up the original. We have a utility setter that
handles this exact case so we should use it.

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

index d331c193a452e3a3e587f2ca6c3668987c091013..23ebac1bacbc1a6121bebb3029f2a5ba5805c18a 100644 (file)
@@ -5941,7 +5941,7 @@ librados::ObjectCursor librados::IoCtx::object_list_begin()
 {
   hobject_t *h = new hobject_t(io_ctx_impl->objecter->enumerate_objects_begin());
   ObjectCursor oc;
-  oc.c_cursor = (rados_object_list_cursor)h;
+  oc.set((rados_object_list_cursor)h);
   return oc;
 }
 
@@ -5950,7 +5950,7 @@ librados::ObjectCursor librados::IoCtx::object_list_end()
 {
   hobject_t *h = new hobject_t(io_ctx_impl->objecter->enumerate_objects_end());
   librados::ObjectCursor oc;
-  oc.c_cursor = (rados_object_list_cursor)h;
+  oc.set((rados_object_list_cursor)h);
   return oc;
 }