1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +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 NIIBE Yutaka
parent 0fd4cd8503
commit ced689e12a

View File

@ -2182,6 +2182,7 @@ p12_build (gcry_mpi_t *kparms, unsigned char *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;
} }
@ -2196,6 +2197,7 @@ p12_build (gcry_mpi_t *kparms, unsigned char *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;
} }