From: Christian Brabandt Date: Fri, 5 Jul 2024 07:54:30 +0000 (+0200) Subject: patch 9.1.0531: resource leak in mch_get_random() X-Git-Tag: v9.1.0531^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93a3d2b905f1012aa0eac8db36b31ce01c3571f3;p=thirdparty%2Fvim.git 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 --- diff --git a/src/os_unix.c b/src/os_unix.c index b7da55205d..474d288019 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -7740,7 +7740,10 @@ mch_get_random(char_u *buf, int len) 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 159fe3b814..9cf60326ae 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 531, /**/ 530, /**/