g10: Release resources when returning an error in get_seckey.
authorNeal H. Walfield <neal@g10code.com>
Wed, 16 Sep 2015 12:03:50 +0000 (14:03 +0200)
committerNeal H. Walfield <neal@g10code.com>
Wed, 16 Sep 2015 13:15:28 +0000 (15:15 +0200)
* g10/getkey.c (get_seckey): If the key doesn't have a secret key,
release *PK.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
g10/getkey.c

index 0399344..18ef84e 100644 (file)
@@ -562,7 +562,11 @@ get_seckey (PKT_public_key *pk, u32 *keyid)
   release_kbnode (keyblock);
 
   if (!err)
-    err = agent_probe_secret_key (/*ctrl*/NULL, pk);
+    {
+      err = agent_probe_secret_key (/*ctrl*/NULL, pk);
+      if (err)
+       release_public_key_parts (pk);
+    }
 
   return err;
 }