mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
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>
This commit is contained in:
parent
7a44f96fe7
commit
93a3d2b905
@ -7740,7 +7740,10 @@ mch_get_random(char_u *buf, int len)
|
|||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
dev_urandom_state = FAIL;
|
dev_urandom_state = FAIL;
|
||||||
else if (read(fd, buf, len) == len)
|
else if (read(fd, buf, len) == len)
|
||||||
|
{
|
||||||
dev_urandom_state = OK;
|
dev_urandom_state = OK;
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dev_urandom_state = FAIL;
|
dev_urandom_state = FAIL;
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
531,
|
||||||
/**/
|
/**/
|
||||||
530,
|
530,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user