summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Klöcker <dev@ingo-kloecker.de>2023-01-31 09:10:57 +0100
committerIngo Klöcker <dev@ingo-kloecker.de>2023-01-31 12:01:33 +0100
commit2b98585c89c1654aa736777eeb92ff79d5fdd72b (patch)
treea9e1b9b277bdbd35ae5adf089fe09b92f89a8d61
parent5d07f8db7763d5cc48c7b27d5cc67d74fad77ea4 (diff)
downloadgpgme-2b98585c89c1654aa736777eeb92ff79d5fdd72b.tar.gz
qt,tests: Avoid leaking Context
* lang/qt/tests/t-import.cpp: Wrap Context*s in unique_ptr. -- This fixes leaks found with -fsanitize=address.
-rw-r--r--lang/qt/tests/t-import.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lang/qt/tests/t-import.cpp b/lang/qt/tests/t-import.cpp
index 2991cf3d..91d5bcbd 100644
--- a/lang/qt/tests/t-import.cpp
+++ b/lang/qt/tests/t-import.cpp
@@ -48,6 +48,8 @@
#include <QTemporaryDir>
#include <QTest>
+#include <memory>
+
using namespace QGpgME;
using namespace GpgME;
@@ -111,7 +113,7 @@ private Q_SLOTS:
QSignalSpy spy (this, SIGNAL(asyncDone()));
QVERIFY(spy.wait());
- auto ctx = Context::createForProtocol(GpgME::OpenPGP);
+ auto ctx = std::unique_ptr<GpgME::Context>(Context::createForProtocol(GpgME::OpenPGP));
GpgME::Error err;
const auto key = ctx->key(keyFpr, err, false);
QVERIFY(!key.isNull());
@@ -155,7 +157,7 @@ private Q_SLOTS:
QSignalSpy spy (this, SIGNAL(asyncDone()));
QVERIFY(spy.wait());
- auto ctx = Context::createForProtocol(GpgME::OpenPGP);
+ auto ctx = std::unique_ptr<GpgME::Context>(Context::createForProtocol(GpgME::OpenPGP));
GpgME::Error err;
const auto key = ctx->key(keyFpr, err, false);
QVERIFY(!key.isNull());
@@ -194,7 +196,7 @@ private Q_SLOTS:
QSignalSpy spy (this, SIGNAL(asyncDone()));
QVERIFY(spy.wait());
- auto ctx = Context::createForProtocol(GpgME::OpenPGP);
+ auto ctx = std::unique_ptr<GpgME::Context>(Context::createForProtocol(GpgME::OpenPGP));
GpgME::Error err;
const auto key = ctx->key(keyFpr, err, false);
QVERIFY(!key.isNull());