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
1 changed files with 2 additions and 0 deletions

View File

@ -2182,6 +2182,7 @@ p12_build (gcry_mpi_t *kparms, unsigned char *cert, size_t certlen,
" requested charset `%s': %s\n",
charset, strerror (errno));
gcry_free (pwbuf);
pwbuf = NULL;
goto failure;
}
@ -2196,6 +2197,7 @@ p12_build (gcry_mpi_t *kparms, unsigned char *cert, size_t certlen,
" requested charset `%s': %s\n",
charset, strerror (errno));
gcry_free (pwbuf);
pwbuf = NULL;
jnlib_iconv_close (cd);
goto failure;
}