aboutsummaryrefslogtreecommitdiffstats
path: root/g10/passphrase.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2005-02-15 11:02:32 +0000
committerWerner Koch <[email protected]>2005-02-15 11:02:32 +0000
commitbb71180d07b0ce8a2293acf61541cf631f285012 (patch)
tree895410ed291b16654608a02c407b93db7adba325 /g10/passphrase.c
parent* curl-shim.c (curl_easy_perform): Fix compile warning. (diff)
downloadgnupg-bb71180d07b0ce8a2293acf61541cf631f285012.tar.gz
gnupg-bb71180d07b0ce8a2293acf61541cf631f285012.zip
* gpg.sgml: Add bkuptocard command for --edit-key.
* passphrase.c (agent_get_passphrase): Don't call free_public_key if PK is NULL. (passphrase_clear_cache): Ditto. Removed debug output. (passphrase_to_dek): Ditto.
Diffstat (limited to 'g10/passphrase.c')
-rw-r--r--g10/passphrase.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/g10/passphrase.c b/g10/passphrase.c
index eed2399dd..da2820b17 100644
--- a/g10/passphrase.c
+++ b/g10/passphrase.c
@@ -1,6 +1,6 @@
/* passphrase.c - Get a passphrase
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
- * 2004 Free Software Foundation, Inc.
+ * 2004, 2005 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -661,7 +661,8 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *tryagain_text,
memset (fpr, 0, MAX_FINGERPRINT_LEN );
if( keyid && get_pubkey( pk, keyid ) )
{
- free_public_key( pk );
+ if (pk)
+ free_public_key( pk );
pk = NULL; /* oops: no key for some reason */
}
@@ -795,7 +796,8 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *tryagain_text,
}
pw[pwlen] = 0; /* make a C String */
agent_close (fd);
- free_public_key( pk );
+ if (pk)
+ free_public_key( pk );
#ifdef ENABLE_NLS
if (orig_codeset)
bind_textdomain_codeset (PACKAGE, orig_codeset);
@@ -912,7 +914,8 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *tryagain_text,
pw[pwlen++] = xtoi_2 (pw+i);
pw[pwlen] = 0; /* make a C String */
agent_close (fd);
- free_public_key( pk );
+ if (pk)
+ free_public_key( pk );
#ifdef ENABLE_NLS
if (orig_codeset)
bind_textdomain_codeset (PACKAGE, orig_codeset);
@@ -946,7 +949,8 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *tryagain_text,
if ( fd != -1 )
agent_close (fd);
m_free (pw );
- free_public_key( pk );
+ if (pk)
+ free_public_key( pk );
return NULL;
#endif /* Posix or W32 */
@@ -981,7 +985,6 @@ passphrase_clear_cache ( u32 *keyid, int algo )
memset (fpr, 0, MAX_FINGERPRINT_LEN );
if( !keyid || get_pubkey( pk, keyid ) )
{
- log_debug ("oops, no key in passphrase_clear_cache\n");
goto failure; /* oops: no key for some reason */
}
@@ -1051,7 +1054,8 @@ passphrase_clear_cache ( u32 *keyid, int algo )
failure:
if (fd != -1)
agent_close (fd);
- free_public_key( pk );
+ if (pk)
+ free_public_key( pk );
#endif /* Posix or W32 */
}
@@ -1208,7 +1212,8 @@ passphrase_to_dek( u32 *keyid, int pubkey_algo,
}
tty_printf("\n");
- free_public_key( pk );
+ if (pk)
+ free_public_key( pk );
}
agent_died: