From: Danny Al-Gaaf Date: Mon, 20 Feb 2017 16:08:39 +0000 (+0100) Subject: cls_rgw_client.h: Close resource leak X-Git-Tag: v12.0.2~116^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d6b4ff076af2c09b389173527d279e879439f2f2;p=ceph-ci.git cls_rgw_client.h: Close resource leak Fix for: CID 1395687 (#1 of 1): Resource leak (RESOURCE_LEAK) CID 1395679 (#1 of 1): Resource leak (RESOURCE_LEAK) leaked_storage: Variable c going out of scope leaks the storage it points to. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/cls/rgw/cls_rgw_client.h b/src/cls/rgw/cls_rgw_client.h index 084e2578052..aa2413fdb91 100644 --- a/src/cls/rgw/cls_rgw_client.h +++ b/src/cls/rgw/cls_rgw_client.h @@ -101,6 +101,8 @@ public: int r = io_ctx.aio_operate(oid, c, (librados::ObjectReadOperation*)op, NULL); if (r >= 0) { add_pending(arg->id, c, oid); + } else { + c->release(); } return r; } @@ -115,6 +117,8 @@ public: int r = io_ctx.aio_operate(oid, c, (librados::ObjectWriteOperation*)op); if (r >= 0) { add_pending(arg->id, c, oid); + } else { + c->release(); } return r; }