diff --git a/libraries/networking/src/AccountManager.cpp b/libraries/networking/src/AccountManager.cpp index 4f68c2c44c..8cb48317b6 100644 --- a/libraries/networking/src/AccountManager.cpp +++ b/libraries/networking/src/AccountManager.cpp @@ -390,11 +390,19 @@ void AccountManager::sendRequest(const QString& path, // double check if the finished network reply had a session ID in the header and make // sure that our session ID matches that value if so - connect(networkReply, &QNetworkReply::finished, this, [this, networkReply]{ + connect(networkReply, &QNetworkReply::finished, this, [this, callbackParams, networkReply]{ if (networkReply->error() == QNetworkReply::NoError) { if (networkReply->hasRawHeader(METAVERSE_SESSION_ID_HEADER)) { _sessionID = networkReply->rawHeader(METAVERSE_SESSION_ID_HEADER); } + + if (!callbackParams.jsonCallbackReceiver) { + networkReply->deleteLater(); + } + } else { + if (!callbackParams.errorCallbackReceiver) { + networkReply->deleteLater(); + } } }); }