Index: b/agent/command.c =================================================================== --- b/agent/command.c +++ b/agent/command.c @@ -843,7 +843,6 @@ line = skip_options (line); - p = line; for (p=line; *p && *p != ' ' && *p != '\t'; p++) ; *p = '\0'; @@ -960,7 +959,6 @@ opt_inq_passwd = has_option (line, "--inq-passwd"); line = skip_options (line); - p = line; for (p=line; *p && *p != ' ' && *p != '\t'; p++) ; *p = '\0'; @@ -2068,7 +2066,6 @@ opt_unattended = has_option (line, "--unattended"); line = skip_options (line); - p = line; for (p=line; *p && *p != ' ' && *p != '\t'; p++) ; *p = '\0'; Index: b/agent/trustlist.c =================================================================== --- b/agent/trustlist.c +++ b/agent/trustlist.c @@ -398,7 +398,7 @@ istrusted_internal (ctrl_t ctrl, const char *fpr, int *r_disabled, int already_locked) { - gpg_error_t err; + gpg_error_t err = GPG_ERR_NO_ERROR; int locked = already_locked; trustitem_t *ti; size_t len; Index: b/g10/armor.c =================================================================== --- b/g10/armor.c +++ b/g10/armor.c @@ -274,7 +274,6 @@ return 0; /* too short or too long */ if( memcmp( line, "Hash:", 5 ) ) return 0; /* invalid header */ - s = line+5; for(s=line+5;;s=s2) { for(; *s && (*s==' ' || *s == '\t'); s++ ) ; Index: b/g10/getkey.c =================================================================== --- b/g10/getkey.c +++ b/g10/getkey.c @@ -196,7 +196,7 @@ /* Remove the last 50% of the entries. */ for (ce = pk_cache, n = 0; ce && n < pk_cache_entries/2; n++) ce = ce->next; - if (ce != pk_cache && ce->next) + if (ce && ce != pk_cache && ce->next) { ce2 = ce->next; ce->next = NULL; @@ -300,7 +300,7 @@ /* First check for duplicates. */ for (r = user_id_db; r; r = r->next) { - keyid_list_t b = r->keyids; + keyid_list_t b; for (b = r->keyids; b; b = b->next) { if (!memcmp (b->fpr, a->fpr, MAX_FINGERPRINT_LEN)) Index: b/g10/keyedit.c =================================================================== --- b/g10/keyedit.c +++ b/g10/keyedit.c @@ -854,7 +854,7 @@ show_key_with_all_names (ctrl, fp, keyblock, 1, 0, 1, 0, 0, 0); tty_fprintf (fp, "\n"); - if (primary_pk->expiredate && !selfsig) + if (primary_pk && primary_pk->expiredate && !selfsig) { u32 now = make_timestamp (); Index: b/g10/keygen.c =================================================================== --- b/g10/keygen.c +++ b/g10/keygen.c @@ -2251,7 +2251,6 @@ if (subkey_algo && *subkey_algo == PUBKEY_ALGO_ECDSA) { *subkey_algo = PUBKEY_ALGO_EDDSA; - result = xstrdup ("Ed25519"); } *algo = PUBKEY_ALGO_EDDSA; result = xstrdup ("Ed25519"); Index: b/g10/keyid.c =================================================================== --- b/g10/keyid.c +++ b/g10/keyid.c @@ -806,7 +806,7 @@ keygrip_from_pk (PKT_public_key *pk, unsigned char *array) { gpg_error_t err; - gcry_sexp_t s_pkey; + gcry_sexp_t s_pkey = NULL; if (DBG_PACKET) log_debug ("get_keygrip for public key\n"); @@ -865,11 +865,11 @@ if (err) return err; - if (!gcry_pk_get_keygrip (s_pkey, array)) + if (!s_pkey || !gcry_pk_get_keygrip (s_pkey, array)) { log_info ("error computing keygrip\n"); memset (array, 0, 20); - err = gpg_error (GPG_ERR_GENERAL); + return gpg_error (GPG_ERR_GENERAL); } else { Index: b/g10/keyserver.c =================================================================== --- b/g10/keyserver.c +++ b/g10/keyserver.c @@ -1977,9 +1977,13 @@ if (err) { - xfree(*fpr); - *fpr = NULL; - *fpr_len = 0; + if (fpr) + { + xfree(*fpr); + *fpr = NULL; + } + if (fpr_len) + *fpr_len = 0; } return err; Index: b/g10/misc.c =================================================================== --- b/g10/misc.c +++ b/g10/misc.c @@ -1584,7 +1584,7 @@ pubkey_nbits( int algo, gcry_mpi_t *key ) { int rc, nbits; - gcry_sexp_t sexp; + gcry_sexp_t sexp = NULL; if (algo == PUBKEY_ALGO_DSA && key[0] && key[1] && key[2] && key[3]) Index: b/g10/pkglue.c =================================================================== --- b/g10/pkglue.c +++ b/g10/pkglue.c @@ -57,7 +57,7 @@ pk_verify (pubkey_algo_t pkalgo, gcry_mpi_t hash, gcry_mpi_t *data, gcry_mpi_t *pkey) { - gcry_sexp_t s_sig, s_hash, s_pkey; + gcry_sexp_t s_sig, s_hash, s_pkey = NULL; int rc; /* Make a sexp from pkey. */ @@ -310,7 +310,7 @@ int pk_check_secret_key (pubkey_algo_t pkalgo, gcry_mpi_t *skey) { - gcry_sexp_t s_skey; + gcry_sexp_t s_skey = NULL; int rc; if (pkalgo == PUBKEY_ALGO_DSA) Index: b/sm/call-dirmngr.c =================================================================== --- b/sm/call-dirmngr.c +++ b/sm/call-dirmngr.c @@ -402,7 +402,6 @@ ; if (*s || (n != 40)) return 0; /* no fingerprint (invalid or wrong length). */ - n /= 2; for (s=hexstr, n=0; *s; s += 2, n++) fpr[n] = xtoi_2 (s); return 1; /* okay */ Index: b/sm/minip12.c =================================================================== --- b/sm/minip12.c +++ b/sm/minip12.c @@ -1012,7 +1012,6 @@ log_error ( "error allocating result array\n"); goto bailout; } - result_count = 0; where = "reading.keybag.key-parameters"; for (result_count = 0; len && result_count < 9;)