summaryrefslogtreecommitdiff
path: root/random
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-12-06 11:30:04 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2021-12-06 11:30:04 +0900
commit751fcadd34ed42b2e595664e9ec3f88fd074d7b7 (patch)
tree8951031ab88c1b86e26d9279f51cc7735a7ec5c3 /random
parent5425052f38cd41a99469e4c3245a1c3e037410fe (diff)
downloadlibgcrypt-751fcadd34ed42b2e595664e9ec3f88fd074d7b7.tar.gz
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 <gniibe@fsij.org>
Diffstat (limited to 'random')
-rw-r--r--random/random-drbg.c6
1 files changed, 4 insertions, 2 deletions
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 ();