patch 9.1.0531: resource leak in mch_get_random()

Commit: 
https://github.com/vim/vim/commit/93a3d2b905f1012aa0eac8db36b31ce01c3571f3
Author: Christian Brabandt <c...@256bit.org>
Date:   Fri Jul 5 09:54:30 2024 +0200

    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 <c...@256bit.org>

diff --git a/src/os_unix.c b/src/os_unix.c
index b7da55205..474d28801 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 159fe3b81..9cf60326a 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,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1sPdrW-003wTE-7h%40256bit.org.

Raspunde prin e-mail lui