https://bugs.kde.org/show_bug.cgi?id=432726
David Faure <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Latest Commit| |https://invent.kde.org/fram | |eworks/karchive/commit/cdba | |e9e7d0780d9f00ad83720d9522d | |ad3168a49 Version Fixed In| |5.95 Status|REPORTED |RESOLVED --- Comment #2 from David Faure <[email protected]> --- Git commit cdbae9e7d0780d9f00ad83720d9522dad3168a49 by David Faure, on behalf of Ahmad Samir. Committed on 22/05/2022 at 15:30. Pushed by dfaure into branch 'master'. Always delete device if we created it To test: KZip zip{QStringLiteral("/unwritable_file.zip")}; zip.open(QIODevice::ReadWrite); - createDevice() is called, which allocates a QFile and assigns it to d->dev - but the kArchive::open() call itself will fail, which means that in the KZip destructor isOpen() will return false, so close() is never called which leaks the d->dev object Calling delete on a nullptr isn't a problem. We can't assign a parent for d->dev because KArchive isn't a QObject; also we can't use a std::unique_ptr to manage it because KArchive doesn't always own the QIODevice object (users can construct a KArchive with a QIODevice that they own and pass it to KArchive by e.g. setDevice()). Thanks for the very detailed bug report. FIXED-IN: 5.95 M +5 -0 src/karchive_p.h https://invent.kde.org/frameworks/karchive/commit/cdbae9e7d0780d9f00ad83720d9522dad3168a49 -- You are receiving this mail because: You are watching all bug changes.
