From f7527f4e91f8d38e6c36d69e79f153145a5cc16b Mon Sep 17 00:00:00 2001 From: Stefan Mayer Date: Tue, 10 Apr 2018 21:19:14 +0200 Subject: [PATCH] [BUGFIX] fixed memory leak in QHttpConnection class (delete m_request object if the connection is destroyed) --- src/qhttpconnection.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qhttpconnection.cpp b/src/qhttpconnection.cpp index fc3e9e1..9337399 100644 --- a/src/qhttpconnection.cpp +++ b/src/qhttpconnection.cpp @@ -69,6 +69,9 @@ QHttpConnection::~QHttpConnection() delete m_parserSettings; m_parserSettings = 0; + + delete m_request; + m_request = 0; } void QHttpConnection::socketDisconnected() @@ -229,6 +232,7 @@ int QHttpConnection::HeadersComplete(http_parser *parser) connect(theConnection, SIGNAL(destroyed()), response, SLOT(connectionClosed())); connect(response, SIGNAL(done()), theConnection, SLOT(responseDone())); + connect(theConnection, SIGNAL(destroyed()), theConnection->m_request, SLOT(deleteLater())); // we are good to go! Q_EMIT theConnection->newRequest(theConnection->m_request, response);