Menu

#496 memory leak in dpx.c

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

Here is the critical code : (in dpx.c)

 user_data_length=0UL;
          user_data=(unsigned char *) NULL;

          while (user_data_length < dpx_file_info.user_defined_length)
            {
              read_size=Min(block_size,dpx_file_info.user_defined_length-user_data_length);
              MagickReallocMemory(unsigned char *,user_data,user_data_length+read_size);//1890
              if (user_data == (unsigned char *) NULL)
                ThrowDPXReaderException(ResourceLimitError,MemoryAllocationFailed,image);
              if (ReadBlob(image,read_size,user_data+user_data_length) != read_size)
                ThrowDPXReaderException(CorruptImageError,UnexpectedEndOfFile,image);//not free 1890
              user_data_length += read_size;
              offset += read_size;
            }

          dpx_user_data=(DPXUserDefinedData *) user_data;
          StringToAttribute(image,"DPX:user.data.id",dpx_user_data->user_id);
          if (!SetImageProfile(image,"DPXUSERDATA",user_data,user_data_length))
            ThrowDPXReaderException(ResourceLimitError,MemoryAllocationFailed,image);//1902

Line 1902 do not free memory about user_data, this will cause memory leak.

Credit: ADLab of Venustech

Discussion

  • Bob Friesenhahn

    Bob Friesenhahn - 2017-09-30
    • status: open --> closed-fixed
    • assigned_to: Bob Friesenhahn
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2017-09-30

    This problem is fixed by Mercurial changeset 15202:184d7dcde5d1. Thanks for the report!

     

Log in to post a comment.

MongoDB Logo MongoDB