Skip to content

memory leak bug in MagickCore/animate.c: AcquireMagickMemory() function #1195

Closed
@hanguanggithub

Description

@hanguanggithub

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am using the latest version of ImageMagick
  • I have searched open and closed issues to ensure it has not already been reported

Description

hello,i find a memory leak bug in imagemagick,the details is on the Steps to Reproduce.

Steps to Reproduce

the bug located in animate.c,
static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
XWindows *windows,const CommandType command_type,
Image **image, MagickStatusType *state,
ExceptionInfo *exception) functiion
the bug code is on
https://github.com/ImageMagick/ImageMagick/blob/master/MagickCore/animate.c#L424
the code fragment is as follows:
filelist=(char **) AcquireMagickMemory(sizeof(char *));

we can see that we allocate a memory and assigned it to file list,but we forget to free it in the code:
https://github.com/ImageMagick/ImageMagick/blob/master/MagickCore/animate.c#L434
the code fragment is as follows:

if ((status == MagickFalse) || (number_files == 0))
        {
          if (number_files == 0)
            {
              ThrowXWindowException(ImageError,"NoImagesWereLoaded",filenames);
             return((Image *) NULL);
            }
          ThrowXWindowException(ResourceLimitError,"MemoryAllocationFailed",
            filenames);
          return((Image *) NULL);
        }

credit:www.vackbot.com(墨云科技)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions