From 751fcadd34ed42b2e595664e9ec3f88fd074d7b7 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Mon, 6 Dec 2021 11:30:04 +0900 Subject: random: Release memory in DRBG. * random/random-drbg.c (_gcry_rngdrbg_close_fds): Release DRBG_STATE. -- Fixes-commit: 204be8a385ae6140175e3b495989a261410c34d0 GnuPG-bug-id: 5636 Signed-off-by: NIIBE Yutaka --- random/random-drbg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'random') diff --git a/random/random-drbg.c b/random/random-drbg.c index 500ae645..70ede2a4 100644 --- a/random/random-drbg.c +++ b/random/random-drbg.c @@ -1863,8 +1863,9 @@ _gcry_rngdrbg_reinit (const char *flagstr, gcry_buffer_t *pers, int npers) return ret; } -/* Try to close the FDs of the random gather module. This is - * currently only implemented for rndlinux. */ +/* Release resources used by this DRBG module. That is, close the FDs + * of the random gather module (if any), and release memory used. + */ void _gcry_rngdrbg_close_fds (void) { @@ -1878,6 +1879,7 @@ _gcry_rngdrbg_close_fds (void) if (drbg_state) { drbg_uninstantiate (drbg_state); + xfree (drbg_state); drbg_state = NULL; } drbg_unlock (); -- cgit v1.2.1