aboutsummaryrefslogtreecommitdiff
path: root/quotest/quotest.cpp
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-09-12 05:22:53 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-09-12 05:38:00 +0200
commitbcaab611840a0a2ad284e6f1e7c2f0b4de10222d (patch)
treee32cb5cce3a715476bb3f38971055e2b7aba4443 /quotest/quotest.cpp
parent167509514587aa22d837b42a8d30d7c1128e0a45 (diff)
downloadlibquotient-bcaab611840a0a2ad284e6f1e7c2f0b4de10222d.tar.gz
libquotient-bcaab611840a0a2ad284e6f1e7c2f0b4de10222d.zip
Fix a memory leak in DownloadRunner
Diffstat (limited to 'quotest/quotest.cpp')
-rw-r--r--quotest/quotest.cpp9
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();