From e4c8f00e14b01184eba68f733b6a0e57dcb77c7c Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 21 May 2023 07:00:06 +0300 Subject: [PATCH] kutils: plug KArchive memory leaks Signed-off-by: Ivailo Monev --- kutils/karchive/karchive.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kutils/karchive/karchive.cpp b/kutils/karchive/karchive.cpp index 1a9d8b5b..06278a3c 100644 --- a/kutils/karchive/karchive.cpp +++ b/kutils/karchive/karchive.cpp @@ -511,6 +511,7 @@ bool KArchive::add(const QStringList &paths, const QByteArray &strip, const QByt if (!readarchive) { d->m_error = i18n("Could not open archive: %1", d->m_path); kDebug() << d->m_error; + KArchivePrivate::closeWrite(writearchive); return result; } @@ -739,6 +740,7 @@ bool KArchive::remove(const QStringList &paths) const if (!writearchive) { d->m_error = i18n("Could not open temporary archive: %1", tmpfile); kDebug() << d->m_error; + KArchivePrivate::closeRead(readarchive); return result; } @@ -867,6 +869,7 @@ bool KArchive::extract(const QStringList &paths, const QString &destination, con if (!writearchive) { d->m_error = i18n("Could not open destination: %1", destination); kDebug() << d->m_error; + KArchivePrivate::closeRead(readarchive); return result; }