I'm working on observing our production system's memory leak problem recently. Unfortunately I found another memory leak in ImageMagick. Although it's not a big deal, I still put it here to let you know. Again, it's a corrupted png. It also exists in early version like 6.2.8. I noticed that when the following setjmp is returned through longjmp, the value of ping_pixels will be NULL, so when you switch "gcc -O " on, the code which is responsible for releasing the resources is optimized by the compile.
Code: Select all
if (ping_pixels != (unsigned char *) NULL)
ping_pixels=(unsigned char *) RelinquishMagickMemory(ping_pixels);
Code: Select all
Index: coders/png.c
===================================================================
--- coders/png.c (revision 9547)
+++ coders/png.c (working copy)
@@ -2038,7 +2038,7 @@
x_resolution,
y_resolution;
- unsigned char
+ unsigned char volatile
*ping_pixels;
ssize_t