From: Brad Hubbard Date: Wed, 14 Dec 2016 06:29:08 +0000 (+1000) Subject: librados: Memory leaks in object_list_begin and object_list_end X-Git-Tag: v11.1.1~51^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F12482%2Fhead;p=ceph.git librados: Memory leaks in object_list_begin and object_list_end 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 --- diff --git a/src/librados/librados.cc b/src/librados/librados.cc index d331c193a452..23ebac1bacbc 100644 --- a/src/librados/librados.cc +++ b/src/librados/librados.cc @@ -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; }