qt,tests: Avoid leaking Context
* lang/qt/tests/t-import.cpp: Wrap Context*s in unique_ptr. -- This fixes leaks found with -fsanitize=address.
This commit is contained in:
parent
5d07f8db77
commit
2b98585c89
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user