Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-14261

QTiffHandler::option() leaks memory

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.2
    • 4.7.1
    • Image formats
    • None
    • a6e371076a3b2410af2424efc1407c6f5d0b6407

    Description

      QTiffHandler::option() never calls TIFFClose() on the opened TIFF file handle, causing a memory leak.

      The leak can be reproduced with a simple application:

      #include <QCoreApplication>
      #include <QImageReader>
      #include <QRgb>
      
      int main (int argc, char ** argv)
      {
      QImage image(QSize(2, 2), QImage::Format_RGB32);
      image.fill(qRgb(255, 255, 255));
      image.save("/tmp/test.tif");
      
      QImageReader reader("/tmp/test.tif");
      reader.size();
      }
      

      Relevant lines from valgrind log:

      ==22750== 2,340 (996 direct, 1,344 indirect) bytes in 1 blocks are definitely lost in loss record 33 of 35
      ==22750==    at 0x4C284A8: malloc (vg_replace_malloc.c:236)
      ==22750==    by 0x8C7F8E2: TIFFClientOpen (tif_open.c:161)
      ==22750==    by 0x8C5ECDA: QTiffHandler::option(QImageIOHandler::ImageOption) const (qtiffhandler.cpp:603)
      ==22750==    by 0x5100AD4: QImageReader::size() const (qimagereader.cpp:931)
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            treinio Topi Reiniö
            treinio Topi Reiniö
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes