about summary refs log tree commit diff stats
path: root/src/pgp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-08-09 00:54:11 +0100
committerJames Booth <boothj5@gmail.com>2015-08-09 00:54:11 +0100
commit3b79d5aa631469cb9c5d497d68c5d9fd084dcb92 (patch)
tree2687cb282f4b466a2c15cf923e07f0b6cb07f4d4 /src/pgp
parent70c0eeed1e0a2d83449dcbec6daa19f5033470e3 (diff)
downloadprofani-tty-3b79d5aa631469cb9c5d497d68c5d9fd084dcb92.tar.gz
Dereference pgp key
Diffstat (limited to 'src/pgp')
-rw-r--r--src/pgp/gpg.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pgp/gpg.c b/src/pgp/gpg.c
index 724f1e9b..80aba996 100644
--- a/src/pgp/gpg.c
+++ b/src/pgp/gpg.c
@@ -333,12 +333,16 @@ p_gpg_sign(const char * const str, const char * const fp)
     error = gpgme_get_key(ctx, fp, &key, 1);
     if (error || key == NULL) {
         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;
     }
 
     gpgme_signers_clear(ctx);
     error = gpgme_signers_add(ctx, key);
+    gpgme_key_unref(key);
     if (error) {
         log_error("GPG: Failed to load signer. %s %s", gpgme_strsource(error), gpgme_strerror(error));
         gpgme_release(ctx);