From 7a1e6dbfb16f71f692a53f7e0955bde86dbb7fee Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Tue, 9 Oct 2018 10:47:16 +0200 Subject: [PATCH] cpp: Initialize all gpgme_key_t's in context * lang/cpp/src/context.cpp (Context::startKeyListing), (Context::keyListResult, Context::signingKeys): Initialize key. -- "Should" not be neccessary but it's cleaner and would have covered the case of the previous commit. --- lang/cpp/src/context.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp index 1e4e5490..2892d8b4 100644 --- a/lang/cpp/src/context.cpp +++ b/lang/cpp/src/context.cpp @@ -509,7 +509,7 @@ Error Context::startKeyListing(const char *patterns[], bool secretOnly) Key Context::nextKey(GpgME::Error &e) { d->lastop = Private::KeyList; - gpgme_key_t key; + gpgme_key_t key = nullptr; e = Error(d->lasterr = gpgme_op_keylist_next(d->ctx, &key)); return Key(key, false); } @@ -528,7 +528,7 @@ KeyListResult Context::keyListResult() const Key Context::key(const char *fingerprint, GpgME::Error &e , bool secret /*, bool forceUpdate*/) { d->lastop = Private::KeyList; - gpgme_key_t key; + gpgme_key_t key = nullptr; e = Error(d->lasterr = gpgme_get_key(d->ctx, fingerprint, &key, int(secret)/*, int( forceUpdate )*/)); return Key(key, false); } @@ -1067,7 +1067,7 @@ Key Context::signingKey(unsigned int idx) const std::vector Context::signingKeys() const { std::vector result; - gpgme_key_t key; + gpgme_key_t key = nullptr; for (unsigned int i = 0 ; (key = gpgme_signers_enum(d->ctx, i)) ; ++i) { result.push_back(Key(key, false)); }