]> granicus.if.org Git - imagemagick/commitdiff
Fixed memory leak when creating nested exceptions in Magick++.
authorDirk Lemstra <dirk@git.imagemagick.org>
Thu, 9 Feb 2017 20:53:16 +0000 (21:53 +0100)
committerDirk Lemstra <dirk@git.imagemagick.org>
Thu, 9 Feb 2017 20:53:16 +0000 (21:53 +0100)
ChangeLog
Magick++/lib/Exception.cpp

index 8fd79fb16ce260e528e0dd0d111d637e8006b8b6..312a7fd9929781374c4e3e6938c91ef0ac965ecb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-2017-03-07  7.0.4-9 Cristy  <quetzlzacatenango@image...>
+2017-02-09  7.0.4-8 Dirk Lemstra <dirk@lem.....org>
+  * Fixed memory leak when creating nested exceptions in Magick++ (reference
+    https://www.imagemagick.org/discourse-server/viewtopic.php?f=23&p=142634)
+
+2017-02-07  7.0.4-8 Cristy  <quetzlzacatenango@image...>
   * Unbreak build without JPEG support (reference
     https://github.com/ImageMagick/ImageMagick/pull/373).
 
index e2b5098958401c9103c69d67bfdb5a057a5be731..056f87b5a6d44634602266498ca3b22a0becb34e 100644 (file)
@@ -842,6 +842,7 @@ MagickPPExport void Magick::throwException(ExceptionInfo *exception_,
 
   message=formatExceptionMessage(exception_);
   nestedException=(Exception *) NULL;
+  q=(Exception *) NULL;
   LockSemaphoreInfo(exception_->semaphore);
   if (exception_->exceptions != (void *) NULL)
     {
@@ -856,12 +857,18 @@ MagickPPExport void Magick::throwException(ExceptionInfo *exception_,
             exception_->description) != 0))
           {
             if (nestedException == (Exception *) NULL)
-              nestedException=createException(p);
+              {
+                nestedException=createException(p);
+                q=nestedException;
+              }
             else
               {
-                q=createException(p);
-                nestedException->nested(q);
-                nestedException=q;
+                Exception
+                  *r;
+
+                r=createException(p);
+                q->nested(r);
+                q=r;
               }
           }
       }