]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cls_rgw_client.h: Close resource leak
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 20 Feb 2017 16:08:39 +0000 (17:08 +0100)
committerKefu Chai <kchai@redhat.com>
Mon, 10 Apr 2017 10:16:17 +0000 (18:16 +0800)
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 <danny.al-gaaf@bisect.de>
src/cls/rgw/cls_rgw_client.h

index 084e2578052e1366de93863b6eb8cbad9a11221c..aa2413fdb911fe3af8ecb1b69b60544a169ff276 100644 (file)
@@ -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;
   }