Page 1 of 1

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

Posted: 2008-08-29T07:11:53-07:00
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);

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

Posted: 2008-08-29T16:53:13-07:00
by magick
Thanks for the memory leak report. We will have a fix for the problem in the next point release.