H2 protocol handler: make sure inflateEnd gets called on z-stream

The request/reply pair is created out of QNetworkRequest, we set
autoDecompress data-member on the request, but not reply. As a result,
reply in its destructor fails to release memory, allocated by z-lib
(by failing to call inflateEnd). Since with H1 requests it does not
seem to be a problem (no leaks detected), I'm limiting this change
to H2 handler only. Later it will be retired by the stream decompression
change in Qt 6, but will be picked to 5.15.

Fixes: QTBUG-84560
Pick-to: 5.15
Change-Id: I82e19d2b0a83624b730edd20d7d45721e7001731
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Timur Pocheptsov 2020-06-02 12:08:08 +02:00
parent 654a3ad08e
commit 7f927b373e

View File

@ -1209,6 +1209,9 @@ void QHttp2ProtocolHandler::updateStream(Stream &stream, const Frame &frame,
QByteDataBuffer inDataBuffer;
inDataBuffer.append(wrapped);
replyPrivate->uncompressBodyData(&inDataBuffer, &replyPrivate->responseData);
// Now, make sure replyPrivate's destructor will properly clean up
// buffers allocated (if any) by zlib.
replyPrivate->autoDecompress = true;
} else {
replyPrivate->responseData.append(wrapped);
}