1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Dereference pgp key

This commit is contained in:
James Booth 2015-08-09 00:54:11 +01:00
parent 70c0eeed1e
commit 3b79d5aa63

View File

@ -333,12 +333,16 @@ p_gpg_sign(const char * const str, const char * const fp)
error = gpgme_get_key(ctx, fp, &key, 1); error = gpgme_get_key(ctx, fp, &key, 1);
if (error || key == NULL) { if (error || key == NULL) {
log_error("GPG: Failed to get key. %s %s", gpgme_strsource(error), gpgme_strerror(error)); log_error("GPG: Failed to get key. %s %s", gpgme_strsource(error), gpgme_strerror(error));
gpgme_release (ctx); gpgme_release(ctx);
if (key) {
gpgme_key_unref(key);
}
return NULL; return NULL;
} }
gpgme_signers_clear(ctx); gpgme_signers_clear(ctx);
error = gpgme_signers_add(ctx, key); error = gpgme_signers_add(ctx, key);
gpgme_key_unref(key);
if (error) { if (error) {
log_error("GPG: Failed to load signer. %s %s", gpgme_strsource(error), gpgme_strerror(error)); log_error("GPG: Failed to load signer. %s %s", gpgme_strsource(error), gpgme_strerror(error));
gpgme_release(ctx); gpgme_release(ctx);