http: fix leakage of network cache qiodevice
The QIODevice is owned by the caller of data(), so we should have
freed it.
Amends a6776de0c7
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>
This commit is contained in:
parent
d9370d0962
commit
23996976cf
@ -510,7 +510,7 @@ bool QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed(QHttpNetworkRequest &h
|
|||||||
|
|
||||||
it = cacheHeaders.findRawHeader("content-length");
|
it = cacheHeaders.findRawHeader("content-length");
|
||||||
if (it != cacheHeaders.rawHeaders.constEnd()) {
|
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())
|
if (!data || data->size() < it->second.toLongLong())
|
||||||
return false; // The data is smaller than the content-length specified
|
return false; // The data is smaller than the content-length specified
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user