]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Mon, 24 Apr 2017 15:03:23 +0000 (11:03 -0400)
committerCristy <urban-warrior@imagemagick.org>
Mon, 24 Apr 2017 15:03:23 +0000 (11:03 -0400)
MagickCore/cache.c
coders/mpc.c

index 61a8d3c63626aa8e99b3fc939768e3efe5f0f4f5..65eec6fd4c91df8997722581a7f7ca1f325e6265 100644 (file)
@@ -3785,7 +3785,7 @@ MagickExport MagickBooleanType PersistPixelCache(Image *image,
     *magick_restrict clone_info;
 
   Image
-    clone_image;
+    *clone_image;
 
   MagickBooleanType
     status;
@@ -3854,8 +3854,8 @@ MagickExport MagickBooleanType PersistPixelCache(Image *image,
   /*
     Clone persistent pixel cache.
   */
-  clone_image=(*image);
-  clone_info=(CacheInfo *) clone_image.cache;
+  clone_image=CloneImage(image,0,0,MagickTrue,exception);
+  clone_info=(CacheInfo *) clone_image->cache;
   image->cache=ClonePixelCache(cache_info);
   cache_info=(CacheInfo *) ReferencePixelCache(image->cache);
   (void) CopyMagickString(cache_info->cache_filename,filename,MagickPathExtent);
@@ -3867,6 +3867,7 @@ MagickExport MagickBooleanType PersistPixelCache(Image *image,
     status=ClonePixelCacheRepository(cache_info,clone_info,exception);
   *offset+=cache_info->length+page_size-(cache_info->length % page_size);
   clone_info=(CacheInfo *) DestroyPixelCache(clone_info);
+  clone_image=DestroyImage(clone_image);
   return(status);
 }
 \f
index 601cf54299abf4b2bb964457c50a9804f1897cde..3a85d5597fee827c9740a7737b74f5c2550e5d4f 100644 (file)
@@ -1467,14 +1467,8 @@ static MagickBooleanType WriteMPCImage(const ImageInfo *image_info,Image *image,
     /*
       Initialize persistent pixel cache.
     */
-    {
-      Image *clone_image=CloneImage(image,0,0,MagickTrue,exception);
-      if (clone_image == (Image *) NULL)
-        ThrowWriterException(CacheError,"UnableToPersistPixelCache");
-      status=PersistPixelCache(clone_image,cache_filename,MagickFalse,&offset,
-        exception);
-      clone_image=DestroyImage(clone_image);
-    }
+    status=PersistPixelCache(image,cache_filename,MagickFalse,&offset,
+      exception);
     if (status == MagickFalse)
       ThrowWriterException(CacheError,"UnableToPersistPixelCache");
     if (GetNextImageInList(image) == (Image *) NULL)