]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: Memory leaks in object_list_begin and object_list_end 13118/head
authorBrad Hubbard <bhubbard@redhat.com>
Wed, 14 Dec 2016 06:29:08 +0000 (16:29 +1000)
committerNathan Cutler <ncutler@suse.com>
Thu, 26 Jan 2017 03:38:42 +0000 (04:38 +0100)
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>
(cherry picked from commit 8d9d84bce923a009054ad2b223a97d7eb00e6774)

src/librados/librados.cc

index 05dfac509f712710513f5aaddc8452668caae07f..1dbb43fd16b35ca0be98bc8a647ffbb9aaccd2e6 100644 (file)
@@ -5514,7 +5514,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;
 }
 
@@ -5523,7 +5523,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;
 }