patch 9.1.0531: resource leak in mch_get_random()
Problem: resource leak in mch_get_random() (after v9.1.0518)
Solution: close file descriptor after reading successfully
from /dev/urandom
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/os_unix.c b/src/os_unix.c
index b7da552..474d288 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -7740,7 +7740,10 @@
if (fd == -1)
dev_urandom_state = FAIL;
else if (read(fd, buf, len) == len)
+ {
dev_urandom_state = OK;
+ close(fd);
+ }
else
{
dev_urandom_state = FAIL;
diff --git a/src/version.c b/src/version.c
index 159fe3b..9cf6032 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 531,
+/**/
530,
/**/
529,