]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG.cc: fix ressource leak, delete cb
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 28 Feb 2014 23:04:05 +0000 (00:04 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 28 Feb 2014 23:04:05 +0000 (00:04 +0100)
CID 1188145 (#1 of 1): Resource leak (RESOURCE_LEAK)
 leaked_storage: Variable "cb" going out of scope leaks the storage it points to.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/osd/ReplicatedPG.cc

index 32171c3ba4bbf6ca9e60460f42d8957b7da50883..52a7690ab2f9cf0b7a3f4fc658b70bb919e34dc4 100644 (file)
@@ -5227,8 +5227,12 @@ int ReplicatedPG::fill_in_copy_get(
       ctx->obc,
       &out_attrs,
       true);
-    if (result < 0)
+    if (result < 0) {
+      if (cb) {
+        delete cb;
+      }
       return result;
+    }
     cursor.attr_complete = true;
     dout(20) << " got attrs" << dendl;
   }
@@ -5250,6 +5254,9 @@ int ReplicatedPG::fill_in_copy_get(
        result = pgbackend->objects_read_sync(
          oi.soid, cursor.data_offset, left, &bl);
        if (result < 0)
+         if (cb) {
+           delete cb;
+         }
          return result;
       }
       assert(result <= left);