Bug 99449

Summary: Memory leaks in Qt frontend
Product: poppler Reporter: Hubert Figuiere <hub>
Component: qt frontendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Proposed patch

Description Hubert Figuiere 2017-01-18 15:04:19 UTC
Running make check on poppler with AddressSanitizer show some memory leaks in the Qt frontends (same code, same bugs).

One set in the actual tests, one in the actual backend.

In the tests:

Direct leak of 32 byte(s) in 2 object(s) allocated from:
    #0 0x7ff23141aea0 in operator new(unsigned long) (/lib64/libasan.so.3+0xc7ea0)
    #1 0x7ff2308a80bf in Poppler::PageData::convertLinkActionToLink(LinkAction*, Poppler::DocumentData*, QRectF const&) /home/hub/source/poppler/qt4/src/poppler-page.cc:98
    #2 0x7ff2308e9628 in Poppler::LinkExtractorOutputDev::processLink(AnnotLink*) /home/hub/source/poppler/qt4/src/poppler-link-extractor.cc:69
    #3 0x7ff230e297fb in Page::processLinks(OutputDev*) /home/hub/source/poppler/poppler/Page.cc:820
    #4 0x7ff2308aed0f in Poppler::Page::links() const /home/hub/source/poppler/qt4/src/poppler-page.cc:732
    #5 0x4025a1 in TestLinks::checkDests_xr01() /home/hub/source/poppler/qt4/tests/check_links.cpp:50
    #6 0x7ff22e0ef7f2 in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/lib64/libQtCore.so.4+0x1a07f2)
    #7 0x7ff22e0f1e05 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (/lib64/libQtCore.so.4+0x1a2e05)
    #8 0x7ff22dd346a6  (/lib64/libQtTest.so.4+0xc6a6)
    #9 0x7ff22dd355ce in QTest::qExec(QObject*, int, char**) (/lib64/libQtTest.so.4+0xd5ce)

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7ff23141aea0 in operator new(unsigned long) (/lib64/libasan.so.3+0xc7ea0)
    #1 0x7ff23089fc3c in Poppler::Document::page(int) const /home/hub/source/poppler/qt4/src/poppler-document.cc:114
    #2 0x402549 in TestLinks::checkDests_xr01() /home/hub/source/poppler/qt4/tests/check_links.cpp:47
    #3 0x7ff22e0ef7f2 in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/lib64/libQtCore.so.4+0x1a07f2)
    #4 0x7ff22e0f1e05 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (/lib64/libQtCore.so.4+0x1a2e05)
    #5 0x7ff22dd346a6  (/lib64/libQtTest.so.4+0xc6a6)
    #6 0x7ff22dd355ce in QTest::qExec(QObject*, int, char**) (/lib64/libQtTest.so.4+0xd5ce)


In the backends:

Direct leak of 56 byte(s) in 1 object(s) allocated from:
    #0 0x7f93ab00dea0 in operator new(unsigned long) (/lib64/libasan.so.3+0xc7ea0)
    #1 0x7f93aa4e3f97 in Poppler::OptContentModelPrivate::parseOrderArray(Poppler::OptContentItem*, Array*) /home/hub/source/poppler/qt4/src/poppler-optcontent.cc:219
    #2 0x7f93aa4e40e0 in Poppler::OptContentModelPrivate::parseOrderArray(Poppler::OptContentItem*, Array*) /home/hub/source/poppler/qt4/src/poppler-optcontent.cc:216
    #3 0x7f93aa4e576a in Poppler::OptContentModelPrivate::OptContentModelPrivate(Poppler::OptContentModel*, OCGs*) /home/hub/source/poppler/qt4/src/poppler-optcontent.cc:183
    #4 0x7f93aa4e5c83 in Poppler::OptContentModel::OptContentModel(OCGs*, QObject*) /home/hub/source/poppler/qt4/src/poppler-optcontent.cc:253
    #5 0x7f93aa495866 in Poppler::Document::optionalContentModel() /home/hub/source/poppler/qt4/src/poppler-document.cc:755
    #6 0x404162 in TestOptionalContent::checkRadioButtons() /home/hub/source/poppler/qt4/tests/check_optcontent.cpp:412
    #7 0x7f93a7ce27f2 in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/lib64/libQtCore.so.4+0x1a07f2)
    #8 0x7f93a7ce4e05 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (/lib64/libQtCore.so.4+0x1a2e05)
    #9 0x7f93a79276a6  (/lib64/libQtTest.so.4+0xc6a6)
    #10 0x7f93a79285ce in QTest::qExec(QObject*, int, char**) (/lib64/libQtTest.so.4+0xd5ce)


(these are for Qt4, but Qt5 show the same things).

Will add patch.
Comment 1 Hubert Figuiere 2017-01-18 15:08:49 UTC
Created attachment 129029 [details] [review]
Proposed patch
Comment 2 Albert Astals Cid 2017-01-19 22:44:47 UTC
Pushed, thanks a lot.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.