]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 22 Aug 2012 12:00:43 +0000 (12:00 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 22 Aug 2012 12:00:43 +0000 (12:00 +0000)
MagickCore/blob.c

index 7fb96c982026dca5e965f7c5e08a41e52fb2c73a..0a38244a6198d840e41dacaa206b35e3d6e2ff3a 100644 (file)
@@ -1543,13 +1543,17 @@ MagickExport unsigned char *ImageToBlob(const ImageInfo *image_info,
           image->blob->exempt=MagickTrue;
           *image->filename='\0';
           status=WriteImage(blob_info,image,exception);
-          if ((status != MagickFalse) && (image->blob->length != 0))
+          if (status != MagickFalse)
             {
-              *length=image->blob->length;
-              blob=DetachBlob(image->blob);
-              blob=(unsigned char *) ResizeQuantumMemory(blob,*length,
-                sizeof(*blob));
+              blob_info->blob=(unsigned char *)
+                RelinquishMagickMemory(blob_info->blob);
+              blob_info=DestroyImageInfo(blob_info);
+              return((unsigned char *) NULL);
             }
+          *length=image->blob->length;
+          blob=DetachBlob(image->blob);
+          blob=(unsigned char *) ResizeQuantumMemory(blob,*length+1,
+            sizeof(*blob));
         }
     }
   else