Memory leak in macro ThrowFileException()

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
jeweljar
Posts: 2
Joined: 2011-01-24T02:29:03-07:00
Authentication code: 8675308

Memory leak in macro ThrowFileException()

Post by jeweljar »

I found a memory leak for the macro ThrowFileException() in magick/exception-private.h

It might be not a big deal.
But I wrote a daemon process using ImageMagick library,
and this leak _matters_ as the daemon's life time goes by.

Here is my patch.

Code: Select all

#define ThrowFileException(exception,severity,tag,context) \
{ \
  char *emsg=GetExceptionMessage(errno); \
  (void) ThrowMagickException(exception,GetMagickModule(),severity, \
    tag == (const char *) NULL ? "unknown" : tag,"`%s': %s",context, \
    emsg); \
  DestroyString(emsg); \
}
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Memory leak in macro ThrowFileException()

Post by magick »

Thanks for the problem alert and patch. We'll get your patch into ImageMagick 6.6.7-3 beta by sometime tomorrow.
Post Reply