MPC: Fix memory leak while writing Magick Persistent Cache format.
--- a/ChangeLog Sat Jul 22 16:29:35 2017 -0500
+++ b/ChangeLog Sat Jul 22 17:56:27 2017 -0500
@@ -1,5 +1,9 @@
2017-07-22 Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
+ * magick/pixel_cache.c (PersistCache): Fix memory leak while
+ writing a MPC file. Problem was reported by LCatro via email on
+ July 18.
+
* coders/map.c (WriteMAPImage): Fix null pointer dereference or
segmentation violation in the MAP writer if the input image is not
already colormapped. Problem was reported by LCatro via email on
--- 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);
}
--- a/www/Changelog.html Sat Jul 22 16:29:35 2017 -0500
+++ b/www/Changelog.html Sat Jul 22 17:56:27 2017 -0500
@@ -38,6 +38,9 @@
<p>2017-07-22 Bob Friesenhahn <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p>
<blockquote>
<ul class="simple">
+<li>magick/pixel_cache.c (PersistCache): Fix memory leak while
+writing a MPC file. Problem was reported by LCatro via email on
+July 18.</li>
<li>coders/map.c (WriteMAPImage): Fix null pointer dereference or
segmentation violation in the MAP writer if the input image is not
already colormapped. Problem was reported by LCatro via email on