]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 10 Sep 2009 15:00:08 +0000 (15:00 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 10 Sep 2009 15:00:08 +0000 (15:00 +0000)
magick/cache.c

index 2794b159b8c03a74b0b62662f628e8276d5be506..7b2882813c1ffea9a592fb1a42c8844e8e9301c2 100644 (file)
@@ -2082,6 +2082,7 @@ MagickExport Cache GetImagePixelCache(Image *image,
     time_limit;
 
   MagickBooleanType
+    destroy,
     status;
 
   if (image->debug != MagickFalse)
@@ -2096,6 +2097,7 @@ MagickExport Cache GetImagePixelCache(Image *image,
     ThrowFatalException(ResourceLimitFatalError,"TimeLimitExceeded");
   assert(image->cache != (Cache) NULL);
   cache_info=(CacheInfo *) image->cache;
+  destroy=MagickFalse;
   (void) LockSemaphoreInfo(cache_info->semaphore);
   if (cache_info->reference_count > 1)
     {
@@ -2121,13 +2123,15 @@ MagickExport Cache GetImagePixelCache(Image *image,
                 status=ClonePixelCachePixels(clone_info,cache_info,exception);
               if (status != MagickFalse)
                 {
-                  cache_info->reference_count--;
+                  destroy=MagickTrue;
                   image->cache=clone_image.cache;
                 }
             }
         }
     }
   (void) UnlockSemaphoreInfo(cache_info->semaphore);
+  if (destroy != MagickFalse)
+    DestroyPixelCache(cache_info);
   if (status != MagickFalse)
     {
       /*