[PATCH] fix double-free in g10/export.c

NIIBE Yutaka gniibe at fsij.org
Fri Oct 21 15:56:36 CEST 2011

Using gnupg of Git master branch, I encountered SEGV (at malloc) when
I did "gpg2 --export-secret-keys".

I think that there is double free in g10/export.c for variable 'list'.

For me, following patch fixed SEGV.

diff --git a/g10/export.c b/g10/export.c
index 7deee6b..9a34852 100644
--- a/g10/export.c
+++ b/g10/export.c
@@ -507,7 +507,7 @@ transfer_format_to_openpgp (gcry_sexp_t s_pgp, PKT_public_key *pk)
   skey[skeyidx++] = NULL;
-  gcry_sexp_release (list);
+  gcry_sexp_release (list); list = NULL;
   /* We have no need for the CSUM valuel thus we don't parse it.  */
   /* list = gcry_sexp_find_token (top_list, "csum", 0); */

More information about the Gnupg-devel mailing list