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

View File

@ -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;
}