summaryrefslogtreecommitdiffstats
path: root/sm/minip12.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2015-01-26 17:56:52 +0100
committerWerner Koch <wk@gnupg.org>2015-01-26 17:56:52 +0100
commit6c87d1ce66d8e93e6c0f16c06116e9179f6158ba (patch)
treeef94f06ea3c78f6bf3affbd3c7a11676b3f889ac /sm/minip12.c
parentccid: Remove incorrect expression leading to errors. (diff)
downloadgnupg2-6c87d1ce66d8e93e6c0f16c06116e9179f6158ba.tar.xz
gnupg2-6c87d1ce66d8e93e6c0f16c06116e9179f6158ba.zip
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>
Diffstat (limited to '')
-rw-r--r--sm/minip12.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/sm/minip12.c b/sm/minip12.c
index ca4d2485d..c70de8a4b 100644
--- a/sm/minip12.c
+++ b/sm/minip12.c
@@ -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);
}