Possible leak in xml-tree.c [IM 6.4.3-5]

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
dirving
Posts: 13
Joined: 2008-08-28T13:45:14-07:00

Possible leak in xml-tree.c [IM 6.4.3-5]

Post by dirving »

On line 557 of xml-tree.c, root->processing_instructions is freed if root->processing_instructions[0] is not NULL. There is however a possibility that the wrapping IF statement is never entered due to the loop above the IF statement destroying root->processing_instructions[0].

Code: Select all

      for (i=0; root->processing_instructions[i] != (char **) NULL; i++)
      {
        for (j=0; root->processing_instructions[i][j] != (char *) NULL; j++)
          root->processing_instructions[i][j]=DestroyString(
            root->processing_instructions[i][j]);
        root->processing_instructions[i][j+1]=DestroyString(
          root->processing_instructions[i][j+1]);
[b]        root->processing_instructions[i]=(char **) RelinquishMagickMemory(
          root->processing_instructions[i]);[/b]
      }
[b]      if (root->processing_instructions[0] != (char **) NULL)[/b]
        root->processing_instructions=(char ***) RelinquishMagickMemory(
          root->processing_instructions);
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Possible leak in xml-tree.c [IM 6.4.3-5]

Post by magick »

Thanks for the memory leak report. We will have a fix for the problem in the next point release.
Post Reply