Fix leak in AkonadiCollectionView
AbandonedPublic

Authored by kfunk on Mon, Dec 3, 10:51 AM.

Details

Reviewers
None
Summary

ASAN trace:
Indirect leak of 48 byte(s) in 1 object(s) allocated from:

#0 0x52f3f0 in operator new(unsigned long) (/home/kfunk/devel/install/kf5/bin/korganizer+0x52f3f0)
#1 0x7fdeef048364 in QHashData::detach_helper(void (*)(QHashData::Node*, void*), void (*)(QHashData::Node*), int, int) /home/kfunk/devel/src/qt5.11/qtbase/src/corelib/tools/qhash.cpp:503:13
#2 0x7fdef07366a8 in QHash<QString, QHashDummyValue>::detach() /home/kfunk/devel/build/qt5.11/qtbase/include/QtCore/../../../../../src/qt5.11/qtbase/src/corelib/tools/qhash.h:275:51
#3 0x7fdef0736823 in QHash<QString, QHashDummyValue>::insert(QString const&, QHashDummyValue const&) /home/kfunk/devel/build/qt5.11/qtbase/include/QtCore/../../../../../src/qt5.11/qtbase/src/corelib/tools/qhash.h:769:5
#4 0x7fdef073654e in QSet<QString>::insert(QString const&) /home/kfunk/devel/build/qt5.11/qtbase/include/QtCore/../../../../../src/qt5.11/qtbase/src/corelib/tools/qset.h:205:62
#5 0x7fdef07b285c in QSet<QString>::unite(QSet<QString> const&) /home/kfunk/devel/build/qt5.11/qtbase/include/QtCore/../../../../../src/qt5.11/qtbase/src/corelib/tools/qset.h:285:9
#6 0x7fdef07b15f1 in KViewStateSerializer::restoreExpanded(QStringList const&) /home/kfunk/devel/src/kf5/kwidgetsaddons/src/kviewstateserializer.cpp:264:28
#7 0x7fdef08ef6aa in KConfigViewStateSaver::restoreState(KConfigGroup const&) /home/kfunk/devel/src/kf5/kconfigwidgets/src/kconfigviewstatesaver.cpp:22:5
#8 0x7fdef25a703f in NewNodeExpander::restoreTreeState() /home/kfunk/devel/src/kf5/korganizer/src/akonadicollectionview.cpp:243:28
...

Diff Detail

Repository
R210 KOrganizer
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5665
Build 5683: arc lint + arc unit
kfunk created this revision.Mon, Dec 3, 10:51 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptMon, Dec 3, 10:51 AM
Restricted Application added a subscriber: kde-pim. · View Herald Transcript
kfunk requested review of this revision.Mon, Dec 3, 10:51 AM
kfunk abandoned this revision.Mon, Dec 3, 12:16 PM

Running into a crash with that patch, need to revisit:

==10521==ERROR: AddressSanitizer: heap-use-after-free on address 0x6030005ab740 at pc 0x7ff8ea006223 bp 0x7fff413c3540 sp 0x7fff413c3538
READ of size 8 at 0x6030005ab740 thread T0
    #0 0x7ff8ea006222 in QScopedPointerDeleter<Akonadi::ETMViewStateSaver>::cleanup(Akonadi::ETMViewStateSaver*) /home/kfunk/devel/build/qt5.11/qtbase/include/QtCore/../../../../../src/qt5.11/qtbase/src/corelib/tools/qscopedpointer.h:60:9
    #1 0x7ff8ea006199 in QScopedPointer<Akonadi::ETMViewStateSaver, QScopedPointerDeleter<Akonadi::ETMViewStateSaver> >::reset(Akonadi::ETMViewStateSaver*) /home/kfunk/devel/build/qt5.11/qtbase/include/QtCore/../../../../../src/qt5.11/qtbase/src/corelib/tools/qscopedpointer.h:159:9
    #2 0x7ff8e9fffd73 in NewNodeExpander::restoreTreeState() /home/kfunk/devel/src/kf5/korganizer/src/akonadicollectionview.cpp:235:27
    #3 0x7ff8e9ffc62c in NewNodeExpander::onSourceRowsInserted(QModelIndex const&, int, int) /home/kfunk/devel/src/kf5/korganizer/src/akonadicollectionview.cpp:183:17