Memory leak in coders/jp2.c

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
visionofarun
Posts: 3
Joined: 2011-12-28T13:10:21-07:00
Authentication code: 8675308

Memory leak in coders/jp2.c

Post by visionofarun »

Hi,

I encountered a memory leak in the coders/jp2.c. I had sent a mail to the imagemagick-bugs mailing list. I was asked to report it here.

Here is the patch for the memory leak. This affects all versions (trunk and stable).

Code: Select all

Index: coders/jp2.c
===================================================================
--- coders/jp2.c        (revision 6269)
+++ coders/jp2.c        (working copy)
@@ -1011,6 +1011,11 @@
  status=jas_image_encode(jp2_image,jp2_stream,format,options) != 0 ?
    MagickTrue : MagickFalse;
  (void) jas_stream_close(jp2_stream);
+  if (options)
+  {
+     free(options);
+     options = (char *) NULL;
+  }
  for (i=0; i < (ssize_t) number_components; i++)
    jas_matrix_destroy(pixels[i]);
  jas_image_destroy(jp2_image);
Regards,
Arun
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Memory leak in coders/jp2.c

Post by magick »

Thanks for the problem report and patch. We'll get the patch into ImageMagick 6.7.4-3 Beta by sometime tomorrow.
visionofarun
Posts: 3
Joined: 2011-12-28T13:10:21-07:00
Authentication code: 8675308

Re: Memory leak in coders/jp2.c

Post by visionofarun »

Thanks for your reply. I am wondering if the Windows binary package will be updated with the memory leak fix.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Memory leak in coders/jp2.c

Post by magick »

Yes, when ImageMagick 6.7.4-3 is release within a few weeks.
Post Reply