# HG changeset patch # User Bob Friesenhahn # Date 1500764187 18000 # Node ID db732abd9318246cca5b07b56b58a22f39d342e0 # Parent 29550606d8b9bf74f9aea0637d11d19fe706871b MPC: Fix memory leak while writing Magick Persistent Cache format. diff -r 29550606d8b9 -r db732abd9318 magick/pixel_cache.c --- a/magick/pixel_cache.c Sat Jul 22 16:29:35 2017 -0500 +++ b/magick/pixel_cache.c Sat Jul 22 17:56:27 2017 -0500 @@ -3458,7 +3458,10 @@ cache_info->type=DiskCache; cache_info->offset=(*offset); if (!OpenCache(clone_image,IOMode,exception)) - return(MagickFail); + { + DestroyImage(clone_image); + return(MagickFail); + } y=0; { ViewInfo @@ -3495,11 +3498,13 @@ CloseCacheView(image_view); CloseCacheView(clone_view); } - cache_info=(CacheInfo*) ReferenceCache(cache_info); + if (y < (long) image->rows) + { + DestroyImage(clone_image); + return(MagickFail); + } + *offset+=cache_info->length+pagesize-(cache_info->length % pagesize); DestroyImage(clone_image); - if (y < (long) image->rows) - return(MagickFail); - *offset+=cache_info->length+pagesize-(cache_info->length % pagesize); (void) LogMagickEvent(CacheEvent,GetMagickModule(),"Clone persistent cache"); return(MagickPass); }