]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: fix possible memory leak when image open fails 10711/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 12 Aug 2016 13:56:49 +0000 (09:56 -0400)
committerJason Dillaman <dillaman@redhat.com>
Mon, 15 Aug 2016 11:48:01 +0000 (07:48 -0400)
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/internal.cc

index d28f8cad2262a9b54447cfaee054e5681d2812b2..cf4aa916ad2d398de3585e50b08691c12b52c5a2 100644 (file)
@@ -910,13 +910,15 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
        if (r < 0) {
          lderr(cct) << "error opening image: "
                     << cpp_strerror(r) << dendl;
+          delete imctx;
          return r;
        }
        librbd::NoOpProgressContext prog_ctx;
        r = imctx->operations->flatten(prog_ctx);
        if (r < 0) {
-         lderr(cct) << "error to flatten image: " << pool << "/" << id_it
+         lderr(cct) << "error flattening image: " << pool << "/" << id_it
                     << cpp_strerror(r) << dendl;
+          imctx->state->close();
          return r;
        }
 
@@ -939,7 +941,7 @@ int mirror_image_disable_internal(ImageCtx *ictx, bool force,
       pctx.update_progress(++i, size);
       assert(i <= size);
     }
-    
+
     return 0;
   }