g10: Minor fixes.
authorNIIBE Yutaka <gniibe@fsij.org>
Mon, 17 Apr 2017 00:15:13 +0000 (09:15 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Mon, 17 Apr 2017 00:15:13 +0000 (09:15 +0900)
* g10/export.c (cleartext_secret_key_to_openpgp): No initialization.
(do_export_one_keyblock): Initialize with GPG_ERR_NOT_FOUND.
* g10/getkey.c (get_best_pubkey_byname): Add non-null check.
* g10/tofu.c (tofu_set_policy): ERR initialize to 0.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
g10/export.c
g10/getkey.c
g10/tofu.c

index 9b203e3..ce79a2f 100644 (file)
@@ -580,7 +580,7 @@ canon_pk_algo (enum gcry_pk_algos algo)
 static gpg_error_t
 cleartext_secret_key_to_openpgp (gcry_sexp_t s_key, PKT_public_key *pk)
 {
-  gpg_error_t err = gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+  gpg_error_t err;
   gcry_sexp_t top_list;
   gcry_sexp_t key = NULL;
   char *key_type = NULL;
@@ -1539,7 +1539,7 @@ do_export_one_keyblock (ctrl_t ctrl, kbnode_t keyblock, u32 *keyid,
                         KEYDB_SEARCH_DESC *desc, size_t ndesc,
                         size_t descindex, gcry_cipher_hd_t cipherhd)
 {
-  gpg_error_t err;
+  gpg_error_t err = gpg_error (GPG_ERR_NOT_FOUND);
   char *cache_nonce = NULL;
   subkey_list_t subkey_list = NULL;  /* Track already processed subkeys. */
   int skip_until_subkey = 0;
index dab63fa..75b8564 100644 (file)
@@ -1654,7 +1654,8 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk,
                   if (! ctx->kr_handle)
                     {
                       xfree (ctx);
-                      *retctx = NULL;
+                      if (retctx)
+                        *retctx = NULL;
                       rc = gpg_error_from_syserror ();
                     }
                   else
index 4e12905..7bef27b 100644 (file)
@@ -3857,7 +3857,7 @@ tofu_get_validity (ctrl_t ctrl, PKT_public_key *pk, strlist_t user_id_list,
 gpg_error_t
 tofu_set_policy (ctrl_t ctrl, kbnode_t kb, enum tofu_policy policy)
 {
-  gpg_error_t err;
+  gpg_error_t err = 0;
   time_t now = gnupg_get_time ();
   tofu_dbs_t dbs;
   PKT_public_key *pk;