Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.1
-
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)