From c23ff539be0f9cedc3308d8c6c83b95af4943908 Mon Sep 17 00:00:00 2001 From: Arttu Tarkiainen Date: Fri, 21 Apr 2023 16:08:05 +0300 Subject: HttpDownloader: fix nullptr dereference The HttpDownloader::Private::shutdown() deletes and sets the pointer to the destination file device to null, and the code tried access its members still afterwards. Changed the order of the calls to fix. Change-Id: I494edfa4af1e112119475c2999ad78e07800194e Reviewed-by: Katja Marttila --- src/libs/kdtools/filedownloader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libs/kdtools/filedownloader.cpp b/src/libs/kdtools/filedownloader.cpp index 6152811aa..a764b6ea4 100644 --- a/src/libs/kdtools/filedownloader.cpp +++ b/src/libs/kdtools/filedownloader.cpp @@ -1509,9 +1509,9 @@ void KDUpdater::HttpDownloader::startDownload(const QUrl &url) qCWarning(QInstaller::lcInstallerInstallLog) << "File exists but installer is unable to open it."; else qCWarning(QInstaller::lcInstallerInstallLog) << "File does not exist."; - d->shutDown(); setDownloadAborted(tr("Cannot download %1. Cannot create file \"%2\": %3").arg( url.toString(), d->destination->fileName(), d->destination->errorString())); + d->shutDown(); } } } -- cgit v1.2.3