]> granicus.if.org Git - imagemagick/commitdiff
https://github.com/ImageMagick/ImageMagick/issues/1211
authorCristy <urban-warrior@imagemagick.org>
Sat, 14 Jul 2018 14:16:36 +0000 (10:16 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sat, 14 Jul 2018 14:16:36 +0000 (10:16 -0400)
MagickCore/blob.c
coders/mat.c

index 8a6b1632e9f858f3aac77ea5a403a00117bf1b12..d2956fef971dcb02b2239c6d2e4d1e6954349789 100644 (file)
@@ -609,9 +609,8 @@ MagickExport MagickBooleanType CloseBlob(Image *image)
   assert(image->signature == MagickCoreSignature);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
-  assert(image->blob != (BlobInfo *) NULL);
   blob_info=image->blob;
-  if (blob_info->type == UndefinedStream)
+  if ((blob_info == (BlobInfo *) NULL) || (blob_info->type == UndefinedStream))
     return(MagickTrue);
   status=SyncBlob(image);
   switch (blob_info->type)
index 3be3bcbb86164ae6f23549c559890dc5023ebabc..5858ff53457cfd5cc61db40cc24c1f8a85d200ab 100644 (file)
@@ -1085,7 +1085,7 @@ MATLAB_KO:
         MATLAB_HDR.StructureClass != mxINT64_CLASS &&
         MATLAB_HDR.StructureClass != mxUINT64_CLASS)    /* uint64 + uint64 3D */
       {
-        if (image2 != (Image*) NULL)
+        if ((image2 != (Image*) NULL) && (image2 != image))
           {
             CloseBlob(image2);
             DeleteImageFromList(&image2);