aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp/src/context.cpp
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2018-10-09 08:47:16 +0000
committerAndre Heinecke <[email protected]>2018-10-09 08:47:16 +0000
commit7a1e6dbfb16f71f692a53f7e0955bde86dbb7fee (patch)
tree66307a7ef51cc8c262fcffa6a0d98143fd43d018 /lang/cpp/src/context.cpp
parentcore: Ensure r_key init in gpgme_get_key (diff)
downloadgpgme-7a1e6dbfb16f71f692a53f7e0955bde86dbb7fee.tar.gz
gpgme-7a1e6dbfb16f71f692a53f7e0955bde86dbb7fee.zip
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.
Diffstat (limited to 'lang/cpp/src/context.cpp')
-rw-r--r--lang/cpp/src/context.cpp6
1 files 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<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));
}