summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2015-10-15 11:28:54 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2015-10-15 11:28:54 +0900
commit1c6d2698a84e4bf82735287c1d64954bfc1a1982 (patch)
treeed9ce1cd3936991b6fe7f6e0602a430a86405353
parent813565a07ca575c87e1252c6ed26018653ecd338 (diff)
downloadlibgcrypt-1c6d2698a84e4bf82735287c1d64954bfc1a1982.tar.gz
Fix double free on error.
* src/hmac256.c (_gcry_hmac256_finalize): Don't free HD.
-rw-r--r--src/hmac256.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/hmac256.c b/src/hmac256.c
index 94a26da4..6b62ed39 100644
--- a/src/hmac256.c
+++ b/src/hmac256.c
@@ -426,10 +426,8 @@ _gcry_hmac256_finalize (hmac256_context_t hd, size_t *r_dlen)
tmphd = _gcry_hmac256_new (NULL, 0);
if (!tmphd)
- {
- free (hd);
- return NULL;
- }
+ return NULL;
+
_gcry_hmac256_update (tmphd, hd->opad, 64);
_gcry_hmac256_update (tmphd, hd->buf, 32);
finalize (tmphd);