From ed8383c618e124cfa708c9ee87563fcdf2f4649c Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Fri, 19 Dec 2014 18:53:34 -0500 Subject: [PATCH] sm: Avoid double-free on iconv failure * sm/minip12.c: (p12_build) if jnlib_iconv_open fails, avoid double-free of pwbuf. -- Observed by Joshua Rogers , who proposed a slightly different fix. Debian-Bug-Id: 773472 Added fix at a second place - wk. --- sm/minip12.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sm/minip12.c b/sm/minip12.c index 01b91b710..ca4d2485d 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; } @@ -2436,6 +2437,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; jnlib_iconv_close (cd); goto failure; }