Fix a few memory leaks ASAN: Fix leak in AppletQuickItem
ClosedPublic

Authored by kfunk on Nov 19 2018, 10:35 PM.

Details

Summary

Direct leak of 3960 byte(s) in 15 object(s) allocated from:

#0 0x544cc0 in operator new(unsigned long) (/home/kfunk/devel/install/kf5/bin/plasmashell+0x544cc0)
#1 0x7f0dd8a3e2bd in PlasmaQuick::AppletQuickItem::AppletQuickItem(Plasma::Applet*, QQuickItem*) /home/kfunk/devel/src/kf5/plasma-framework/src/plasmaquick/appletquickitem.cpp:472:9
#2 0x7f0dcb7b365b in AppletInterface::AppletInterface(DeclarativeAppletScript*, QList<QVariant> const&, QQuickItem*) /home/kfunk/devel/src/kf5/plasma-framework/src/scriptengines/qml/plasmoid/appletinterface.cpp:50:7
#3 0x7f0dcb7aede1 in DeclarativeAppletScript::init() /home/kfunk/devel/src/kf5/plasma-framework/src/scriptengines/qml/plasmoid/declarativeappletscript.cpp:87:27
...

ASAN: Fix memory leak in Corona

KPackagePrivate::internalPackage already existed, the re-assignment to a
new value causes a memory leak.

Trace:
Indirect leak of 112 byte(s) in 1 object(s) allocated from:

#0 0x544cc0 in operator new(unsigned long) (/home/kfunk/devel/install/kf5/bin/plasmashell+0x544cc0)
#1 0x7f905829163f in KPackage::Package::Package(KPackage::PackageStructure*) /home/kfunk/devel/src/kf5/kpackage/src/kpackage/package.cpp:51:9
#2 0x7f9058fad786 in Plasma::Package::Package(Plasma::PackageStructure*) /home/kfunk/devel/src/kf5/plasma-framework/src/plasma/package.cpp:66:34
#3 0x7f9058f14dee in Plasma::Corona::package() const /home/kfunk/devel/src/kf5/plasma-framework/src/plasma/corona.cpp:78:13
#4 0x5d9eb9 in ShellCorona::ShellCorona(QObject*) /home/kfunk/devel/src/kf5/plasma-workspace/shell/shellcorona.cpp:132:70
#5 0x65c31d in ShellManager::loadHandlers() /home/kfunk/devel/src/kf5/plasma-workspace/shell/shellmanager.cpp:93:21

ASAN: Fix memory leak in DataSource

Trace:
Direct leak of 216 byte(s) in 27 object(s) allocated from:

#0 0x544cc0 in operator new(unsigned long) (/home/kfunk/devel/install/kf5/bin/plasmashell+0x544cc0)
#1 0x7fb2e9cd77d9 in Plasma::DataSource::setEngine(QString const&) /home/kfunk/devel/src/kf5/plasma-framework/src/declarativeimports/core/datasource.cpp:93:28
#2 0x7fb2e9d5c8f1 in Plasma::DataSource::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/kfunk/devel/build/kf5/plasma-framework/src/declarativeimports/core/corebindingsplugin_autogen/EWIEGA46WW/moc_datasource.cpp:330:21

ASAN: Fix memory leak in CalendarPlugin

Trace:
Indirect leak of 24 byte(s) in 1 object(s) allocated from:

#0 0x508a17 in __interceptor_malloc (/home/kfunk/devel/install/kf5/bin/plasmashell+0x508a17)
#1 0x7fcf92aa6230 in QHashData::allocateNode(int) /home/kfunk/devel/src/qt5.11/qtbase/src/corelib/tools/qhash.cpp:479:79
#2 0x7fcf7a851d10 in QHash<int, QByteArray>::detach() /home/kfunk/devel/build/qt5.11/qtbase/include/QtCore/../../../../../src/qt5.11/qtbase/src/corelib/tools/qhash.h:275:51
#3 0x7fcf7a8519c9 in QHash<int, QByteArray>::insert(int const&, QByteArray const&) /home/kfunk/devel/build/qt5.11/qtbase/include/QtCore/../../../../../src/qt5.11/qtbase/src/corelib/tools/qhash.h:769:5
#4 0x7fcf7a859736 in EventPluginsModel::EventPluginsModel(EventPluginsManager*) /home/kfunk/devel/src/kf5/plasma-framework/src/declarativeimports/calendar/eventpluginsmanager.cpp:42:17
#5 0x7fcf7a854c55 in EventPluginsManager::EventPluginsManager(QObject*) /home/kfunk/devel/src/kf5/plasma-framework/src/declarativeimports/calendar/eventpluginsmanager.cpp:185:19
...

Diff Detail

Repository
R242 Plasma Framework (Library)
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kfunk created this revision.Nov 19 2018, 10:35 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptNov 19 2018, 10:35 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
kfunk requested review of this revision.Nov 19 2018, 10:35 PM
mart added a subscriber: mart.Nov 20 2018, 9:32 AM

looks good, thanks :)
tough those fixes are quite unrelated, can they be made in separated commits?

mart accepted this revision.Nov 20 2018, 9:32 AM
This revision is now accepted and ready to land.Nov 20 2018, 9:32 AM
This revision was automatically updated to reflect the committed changes.
kfunk added a comment.Nov 20 2018, 2:16 PM

Yep, those are in fact separate commits.