From 23996976cfe79e5f9845a09e26c177d14470c897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 4 Oct 2023 14:36:16 +0200 Subject: [PATCH] http: fix leakage of network cache qiodevice The QIODevice is owned by the caller of data(), so we should have freed it. Amends a6776de0c70d23ac197682c7bef603450cb8b03f Fixes: QTBUG-117787 Pick-to: 6.6 6.5 6.2 Change-Id: Ic5575649038480f52cc13ee229980ee1c7cee728 Reviewed-by: Timur Pocheptsov Reviewed-by: Mate Barany --- src/network/access/qnetworkreplyhttpimpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 8cddb633e4..30fa1a1e52 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -510,7 +510,7 @@ bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &h it = cacheHeaders.findRawHeader("content-length"); if (it != cacheHeaders.rawHeaders.constEnd()) { - QIODevice *data = nc->data(httpRequest.url()); + std::unique_ptr data(nc->data(httpRequest.url())); if (!data || data->size() < it->second.toLongLong()) return false; // The data is smaller than the content-length specified }