Menu

#478 Memory leak in yuv.c

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

Here is the critical code:

  do
  {
    chroma_image=CloneImage(image,image->columns/horizontal_factor,
      image->rows/vertical_factor,True,exception);
    if (chroma_image == (Image *) NULL)
      ThrowYUVReaderException(ResourceLimitError,MemoryAllocationFailed,image);
    /*
      Convert raster image to pixel packets.
    */
    if (image_info->ping && (image_info->subrange != 0))
      if (image->scene >= (image_info->subimage+image_info->subrange-1))
        break;
    if (interlace == PartitionInterlace)
      {
        AppendImageFormat("Y",image->filename);
        status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
        if (status == False)
          ThrowYUVReaderException(FileOpenError,UnableToOpenFile,image);//207
      }  
....
    if (interlace == PartitionInterlace)
      {
        CloseBlob(image);
        AppendImageFormat("U",image->filename);
        status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
        if (status == False)
          ThrowYUVReaderException(FileOpenError,UnableToOpenFile,image);//291
      }
...
      if (interlace == PartitionInterlace)
        {
          CloseBlob(image);
          AppendImageFormat("V",image->filename);
          status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
          if (status == False)
            ThrowYUVReaderException(FileOpenError,UnableToOpenFile,image);//326
        }
...
    resize_image=ResizeImage(chroma_image,image->columns,image->rows,
      TriangleFilter,1.0,exception);
    DestroyImage(chroma_image);
    if (resize_image == (Image *) NULL)
      ThrowYUVReaderException(ResourceLimitError,MemoryAllocationFailed,image);
...
   }

Line 207, 291, 326 do not free memory about chroma_image, this will cause memory leak.

Credit: ADLab of Venustech

Discussion

  • Bob Friesenhahn

    Bob Friesenhahn - 2017-09-30
    • summary: Memory leak in yun.c --> Memory leak in yuv.c
    • status: open --> closed-fixed
    • assigned_to: Bob Friesenhahn
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2017-09-30

    This problem is fixed by Mercurial changeset 15185:45bf86da33da. Thanks for the report!

     

Log in to post a comment.

MongoDB Logo MongoDB