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.
This commit is contained in:
Andre Heinecke 2018-10-09 10:47:16 +02:00
parent ecfa88e65f
commit 7a1e6dbfb1
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C

View File

@ -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<Key> Context::signingKeys() const
{
std::vector<Key> 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));
}