summaryrefslogtreecommitdiffstats
path: root/src/network/access/qnetworkreplyhttpimpl.cpp
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2023-10-04 14:36:16 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2023-10-06 19:40:23 +0200
commit23996976cfe79e5f9845a09e26c177d14470c897 (patch)
tree99a30aeaf7e03a66492fdb1dea0bde5e2ee5a0c5 /src/network/access/qnetworkreplyhttpimpl.cpp
parentd9370d0962a4cf3603e53e6903a52e6e37384dfc (diff)
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 <timur.pocheptsov@qt.io> Reviewed-by: Mate Barany <mate.barany@qt.io>
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp2
1 files changed, 1 insertions, 1 deletions
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<QIODevice> data(nc->data(httpRequest.url()));
if (!data || data->size() < it->second.toLongLong())
return false; // The data is smaller than the content-length specified
}