diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-09-12 05:22:53 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-09-12 05:38:00 +0200 |
commit | bcaab611840a0a2ad284e6f1e7c2f0b4de10222d (patch) | |
tree | e32cb5cce3a715476bb3f38971055e2b7aba4443 | |
parent | 167509514587aa22d837b42a8d30d7c1128e0a45 (diff) | |
download | libquotient-bcaab611840a0a2ad284e6f1e7c2f0b4de10222d.tar.gz libquotient-bcaab611840a0a2ad284e6f1e7c2f0b4de10222d.zip |
Fix a memory leak in DownloadRunner
-rw-r--r-- | quotest/quotest.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/quotest/quotest.cpp b/quotest/quotest.cpp index 31a0b6d6..4142c718 100644 --- a/quotest/quotest.cpp +++ b/quotest/quotest.cpp @@ -445,11 +445,14 @@ struct DownloadRunner { using result_type = QNetworkReply::NetworkError; - QNetworkReply::NetworkError operator()(int) const { + QNetworkReply::NetworkError operator()(int) const + { QEventLoop el; - auto reply = NetworkAccessManager::instance()->get(QNetworkRequest(url)); + QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> reply { + NetworkAccessManager::instance()->get(QNetworkRequest(url)) + }; QObject::connect( - reply, &QNetworkReply::finished, &el, [&el] { el.exit(); }, + reply.data(), &QNetworkReply::finished, &el, [&el] { el.exit(); }, Qt::QueuedConnection); el.exec(); return reply->error(); |