diff options
author | Ingo Klöcker <[email protected]> | 2023-01-31 08:10:57 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2023-01-31 11:01:33 +0000 |
commit | 2b98585c89c1654aa736777eeb92ff79d5fdd72b (patch) | |
tree | a9e1b9b277bdbd35ae5adf089fe09b92f89a8d61 | |
parent | doc: Fix description of gpgme_data_identify (diff) | |
download | gpgme-2b98585c89c1654aa736777eeb92ff79d5fdd72b.tar.gz gpgme-2b98585c89c1654aa736777eeb92ff79d5fdd72b.zip |
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.cpp | 8 |
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()); |