]> git.sommitrealweird.co.uk Git - onak.git/blobdiff - keydb.c
cscvs to tla changeset 35
[onak.git] / keydb.c
diff --git a/keydb.c b/keydb.c
index c5b07c628dfd2040d3152311dc85bec31ce729ad..3acf7112bd110a9a8ebf3ef308d32144dbcda427 100644 (file)
--- a/keydb.c
+++ b/keydb.c
@@ -89,7 +89,7 @@ struct ll *getkeysigs(uint64_t keyid)
  *     @keyid: The 32bit keyid.
  *
  *     This function maps a 32bit key id to the full 64bit one. It returns the
- *     full keyid.
+ *     full keyid. If the key isn't found a keyid of 0 is returned.
  */
 uint64_t getfullkeyid(uint64_t keyid)
 {
@@ -97,8 +97,13 @@ uint64_t getfullkeyid(uint64_t keyid)
 
        if (keyid < 0x100000000LL) {
                fetch_key(keyid, &publickey, false);
-               keyid = get_keyid(publickey);
-               free_publickey(publickey);
+               if (publickey != NULL) {
+                       keyid = get_keyid(publickey);
+                       free_publickey(publickey);
+                       publickey = NULL;
+               } else {
+                       keyid = 0;
+               }
        }
        
        return keyid;