From 2b98585c89c1654aa736777eeb92ff79d5fdd72b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Tue, 31 Jan 2023 09:10:57 +0100 Subject: [PATCH] qt,tests: Avoid leaking Context * lang/qt/tests/t-import.cpp: Wrap Context*s in unique_ptr. -- This fixes leaks found with -fsanitize=address. --- lang/qt/tests/t-import.cpp | 8 +++++--- 1 file 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 #include +#include + 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(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(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(Context::createForProtocol(GpgME::OpenPGP)); GpgME::Error err; const auto key = ctx->key(keyFpr, err, false); QVERIFY(!key.isNull());