1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(toxme): Fixed potential memory leaks

This commit is contained in:
Diadlo 2016-04-08 02:06:03 +03:00 committed by Polshakov Dmitry
parent 11ec3947f5
commit 8f4b6869f1

View File

@ -54,7 +54,9 @@ QByteArray Toxme::makeJsonRequest(QString url, QString json, QNetworkReply::Netw
return QByteArray();
}
return reply->readAll();
QByteArray result = reply->readAll();
delete reply;
return result;
}
QByteArray Toxme::getServerPubkey(QString url, QNetworkReply::NetworkError &error)
@ -236,7 +238,8 @@ QString Toxme::createAddress(ExecCode &code, QString server, ToxId id, QString a
QString pubkeyUrl = server + "/pk";
QString apiUrl = server + "/api";
QNetworkReply::NetworkError error = QNetworkReply::NoError;
QByteArray response = makeJsonRequest(apiUrl, prepareEncryptedJson(pubkeyUrl, 1, payload), error);
QByteArray encrypted = prepareEncryptedJson(pubkeyUrl, 1, payload);
QByteArray response = makeJsonRequest(apiUrl, encrypted, error);
qDebug() << response;
code = extractError(response);