[PATCH] avoid double-free on iconv failure

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Dec 20 00:53:34 CET 2014


* sm/minip12.c: (p12_build) if jnlib_iconv_open fails, avoid
  double-free of pwbuf.

--

Observed by Joshua Rogers <honey at internot.info>, who proposed a
slightly different fix.

Debian-Bug-Id: 773472
---
 sm/minip12.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sm/minip12.c b/sm/minip12.c
index 01b91b7..e269479 100644
--- a/sm/minip12.c
+++ b/sm/minip12.c
@@ -2422,6 +2422,7 @@ p12_build (gcry_mpi_t *kparms, const void *cert, size_t certlen,
                      " requested charset '%s': %s\n",
                      charset, strerror (errno));
           gcry_free (pwbuf);
+          pwbuf = NULL;
           goto failure;
         }
 
-- 
2.1.3




More information about the Gnupg-devel mailing list