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
This commit is contained in:
Kevin Funk 2018-11-19 22:41:38 +01:00
parent e3eafabd55
commit d13f9e6f85

View File

@ -75,9 +75,7 @@ Corona::~Corona()
Plasma::Package Corona::package() const Plasma::Package Corona::package() const
{ {
Package p; return Package(d->package);
p.d->internalPackage = new KPackage::Package(d->package);
return p;
} }
void Corona::setPackage(const Plasma::Package &package) void Corona::setPackage(const Plasma::Package &package)