Menu

#503 memory leak in WritePNMImage

v1.0_(example)
closed-fixed
None
5
2017-10-01
2017-09-25
bestshow
No

Here is the critical code : (in WritePNMImage)

          for (j=0; j < 16; j++)                //1982
            {
              red_map[i][j]=MagickAllocateMemory(unsigned short *,    //1984
                             256*sizeof(unsigned short));
              green_map[i][j]=MagickAllocateMemory(unsigned short *,
                               256*sizeof(unsigned short));
              blue_map[i][j]=MagickAllocateMemory(unsigned short *,
                              256*sizeof(unsigned short));
              if ((red_map[i][j] == (unsigned short *) NULL) ||
              (green_map[i][j] == (unsigned short *) NULL) ||
              (blue_map[i][j] == (unsigned short *) NULL))
            ThrowWriterException(ResourceLimitError,MemoryAllocationFailed,
                         image);
            }

If one of the “red_map[i][j]”、“green_map[i][j]” and “blue_map[i][j]" is not null in “if statement”,it may cause memory leak error.
Credit : ADLab of Venustech

Discussion

  • Bob Friesenhahn

    Bob Friesenhahn - 2017-10-01
    • status: open --> closed-fixed
    • assigned_to: Bob Friesenhahn
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2017-10-01

    This problem is fixed by Mercurial changeset 15213:011296e737a1. Thanks for the report!

     

Log in to post a comment.

MongoDB Logo MongoDB