Fix use of uninitialized value in sgpgme_has_secret_key().
authorAndrej Kacian <ticho@claws-mail.org>
Wed, 12 Jul 2017 07:47:45 +0000 (09:47 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Wed, 12 Jul 2017 07:47:45 +0000 (09:47 +0200)
Fixes commit 11980bc7a.

src/plugins/pgpcore/sgpgme.c

index 0579f42..4ae51b3 100644 (file)
@@ -1098,9 +1098,10 @@ gboolean sgpgme_has_secret_key(void)
        }
 check_again:
        err = gpgme_op_keylist_start(ctx, NULL, TRUE);
-       if (!err)
+       if (!err) {
                err = gpgme_op_keylist_next(ctx, &key);
-       gpgme_key_unref(key); /* We're not interested in the key itself. */
+               gpgme_key_unref(key); /* We're not interested in the key itself. */
+       }
        gpgme_op_keylist_end(ctx);
        if (gpg_err_code(err) == GPG_ERR_EOF) {
                if (gpgme_get_protocol(ctx) != GPGME_PROTOCOL_CMS) {