sm: Simplify fix ed8383c6

* sm/minip12.c (p12_build): Release PWBUF only at the end.
--

Suggested-by: Eygene Ryabinkin <rea@codelabs.ru>
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-01-26 17:56:52 +01:00
parent 274d7b17a9
commit 6c87d1ce66
1 changed files with 2 additions and 4 deletions

View File

@ -2421,8 +2421,6 @@ p12_build (gcry_mpi_t *kparms, const void *cert, size_t certlen,
log_error ("can't convert passphrase to"
" requested charset '%s': %s\n",
charset, strerror (errno));
gcry_free (pwbuf);
pwbuf = NULL;
goto failure;
}
@ -2436,8 +2434,6 @@ p12_build (gcry_mpi_t *kparms, const void *cert, size_t certlen,
log_error ("error converting passphrase to"
" requested charset '%s': %s\n",
charset, strerror (errno));
gcry_free (pwbuf);
pwbuf = NULL;
jnlib_iconv_close (cd);
goto failure;
}
@ -2511,6 +2507,8 @@ p12_build (gcry_mpi_t *kparms, const void *cert, size_t certlen,
failure:
if (pwbuf)
{
/* Note that wipememory is not really needed due to the use of
gcry_malloc_secure. */
wipememory (pwbuf, pwbufsize);
gcry_free (pwbuf);
}