D24716: Fix memory leak of KQuickAddons::ConfigModule objects
Kevin Ottens
noreply at phabricator.kde.org
Thu Oct 17 07:52:08 BST 2019
ervin requested changes to this revision.
ervin added inline comments.
This revision now requires changes to proceed.
INLINE COMMENTS
> kcmoduleloader.cpp:101
> } else {
> KQuickAddons::ConfigModule *cm = factory->create<KQuickAddons::ConfigModule>(nullptr, args2);
> if (!cm) {
Easier fix is likely to wrap that into a std::unique_ptr here and calling release() on it when creating the KCModuleQml later on. Would be even better to change KCModuleQml to take a std::unique_ptr in the ctor and use a unique_ptr internally (AFAICT it's not public API so doable).
That's admittedly more intrusive change though but at least would make some of that ownership issues more explicit and easier to track.
> kcmoduleloader.cpp:107
> return reportError(report, i18n("Error loading QML file."), cm->errorString(), parent);
> + delete cm;
> }
This is unreachable code. You want to delete before the reportError call but after the cm->errorString() call.
REPOSITORY
R295 KCMUtils
REVISION DETAIL
https://phabricator.kde.org/D24716
To: davidedmundson, #plasma, ervin
Cc: ervin, kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191017/ed45df09/attachment.html>
More information about the Kde-frameworks-devel
mailing list