mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.4703: memory leak in handling 'cinscopedecls'
Problem: Memory leak in handling 'cinscopedecls'. Solution: Free the memory before returning.
This commit is contained in:
parent
3506cf34c1
commit
cb49a1d934
@ -425,32 +425,35 @@ cin_islabel_skip(char_u **s)
|
||||
static int
|
||||
cin_isscopedecl(char_u *p)
|
||||
{
|
||||
size_t cinsd_len;
|
||||
char_u *cinsd_buf;
|
||||
char_u *cinsd;
|
||||
size_t len;
|
||||
char_u *skip;
|
||||
char_u *s = cin_skipcomment(p);
|
||||
size_t cinsd_len;
|
||||
char_u *cinsd_buf;
|
||||
char_u *cinsd;
|
||||
size_t len;
|
||||
char_u *skip;
|
||||
char_u *s = cin_skipcomment(p);
|
||||
int found = FALSE;
|
||||
|
||||
cinsd_len = STRLEN(curbuf->b_p_cinsd) + 1;
|
||||
cinsd_buf = alloc(cinsd_len);
|
||||
if (cinsd_buf != NULL)
|
||||
if (cinsd_buf == NULL)
|
||||
return FALSE;
|
||||
|
||||
for (cinsd = curbuf->b_p_cinsd; *cinsd; )
|
||||
{
|
||||
for (cinsd = curbuf->b_p_cinsd; *cinsd; )
|
||||
len = copy_option_part(&cinsd, cinsd_buf, cinsd_len, ",");
|
||||
if (STRNCMP(s, cinsd_buf, len) == 0)
|
||||
{
|
||||
len = copy_option_part(&cinsd, cinsd_buf, cinsd_len, ",");
|
||||
if (STRNCMP(s, cinsd_buf, len) == 0)
|
||||
skip = cin_skipcomment(s + len);
|
||||
if (*skip == ':' && skip[1] != ':')
|
||||
{
|
||||
skip = cin_skipcomment(s + len);
|
||||
if (*skip == ':' && skip[1] != ':')
|
||||
return TRUE;
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
vim_free(cinsd_buf);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
vim_free(cinsd_buf);
|
||||
return found;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -746,6 +746,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
4703,
|
||||
/**/
|
||||
4702,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user