Page 1 of 1

Patch for memory leak in ImageMagick 6.3.5-10

Posted: 2007-09-25T11:02:39-07:00
by magick
Remove
  • *destination=(char *) NULL;
in CloneString() of magick/string.c to fix a memory leak a user identified in ImageMagick 6.3.5-10. The results should look like this:

Code: Select all

  if (source == (const char *) NULL)
    {
      if (*destination != (char *) NULL)
        *destination=DestroyString(*destination);
      return(*destination);
    }
  if (*destination == (char *) NULL)
    {
      *destination=AcquireString(source);
      return(*destination);
    }
  length=strlen(source);
  if (~length < MaxTextExtent)
    ThrowFatalException(ResourceLimitFatalError,"UnableToAcquireString");
  *destination=(char *) ResizeQuantumMemory(*destination,length+MaxTextExtent,
    sizeof(*destination));