0
0
mirror of https://github.com/vim/vim.git synced 2025-11-16 23:24:03 -05:00

patch 9.1.1316: missing memory allocation failure in os_mswin.c

Problem:  missing memory allocation failure in os_mswin.c
Solution: check for memory allocation failure and return early.
          (John Marriott)

closes: #17134

Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
John Marriott
2025-04-17 20:35:42 +02:00
committed by Christian Brabandt
parent cfe502c575
commit 7ddba51635
3 changed files with 9 additions and 2 deletions

View File

@@ -2307,16 +2307,20 @@ findServer(char_u *name)
void
serverSetName(char_u *name)
{
size_t namelen;
char_u *ok_name;
HWND hwnd = 0;
int i = 0;
char_u *p;
// Leave enough space for a 9-digit suffix to ensure uniqueness!
ok_name = alloc(STRLEN(name) + 10);
namelen = STRLEN(name);
ok_name = alloc(namelen + 10);
if (ok_name == NULL)
return;
STRCPY(ok_name, name);
p = ok_name + STRLEN(name);
p = ok_name + namelen;
for (;;)
{