diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2022-07-05 10:17:24 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2022-07-05 10:17:24 +0900 |
commit | e2a7a0c9f5d258051b26babeac20e4a7cfb5a6ac (patch) | |
tree | c8d365456425281ec781ef03f30604fe9e29d4be /cipher/kdf.c | |
parent | c5480b4934bb0adecdfc29a47b5e123f995507e1 (diff) | |
download | libgcrypt-e2a7a0c9f5d258051b26babeac20e4a7cfb5a6ac.tar.gz |
kdf: Fix memory leak on error.
* cipher/kdf.c (hkdf_open): Free the memory on the error path.
--
Reported-by: Guido Vranken <guidovranken@gmail.com>
Fixes-commit: e0f0c788dc0f268965c0f63eb33d9f98c0575d58
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'cipher/kdf.c')
-rw-r--r-- | cipher/kdf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cipher/kdf.c b/cipher/kdf.c index 2e5eef32..d371bdd7 100644 --- a/cipher/kdf.c +++ b/cipher/kdf.c @@ -1699,7 +1699,10 @@ hkdf_open (gcry_kdf_hd_t *hd, int macalgo, } if (outlen > 255 * h->blklen) - return GPG_ERR_INV_VALUE; + { + xfree (h); + return GPG_ERR_INV_VALUE; + } ec = _gcry_mac_open (&h->md, macalgo, 0, NULL); if (ec) |