1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-10 21:38:50 +01:00

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 <honey@internot.info>, who proposed a
slightly different fix.

Debian-Bug-Id: 773472

Added fix at a second place - wk.
This commit is contained in:
Daniel Kahn Gillmor 2014-12-19 18:53:34 -05:00 committed by Werner Koch
parent b0b3803e8c
commit ed8383c618

View File

@ -2422,6 +2422,7 @@ p12_build (gcry_mpi_t *kparms, const void *cert, size_t certlen,
" requested charset '%s': %s\n", " requested charset '%s': %s\n",
charset, strerror (errno)); charset, strerror (errno));
gcry_free (pwbuf); gcry_free (pwbuf);
pwbuf = NULL;
goto failure; goto failure;
} }
@ -2436,6 +2437,7 @@ p12_build (gcry_mpi_t *kparms, const void *cert, size_t certlen,
" requested charset '%s': %s\n", " requested charset '%s': %s\n",
charset, strerror (errno)); charset, strerror (errno));
gcry_free (pwbuf); gcry_free (pwbuf);
pwbuf = NULL;
jnlib_iconv_close (cd); jnlib_iconv_close (cd);
goto failure; goto failure;
} }