mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.4703: memory leak in handling 'cinscopedecls'
Problem: Memory leak in handling 'cinscopedecls'.
Solution: Free the memory before returning.
cb49a1d934
This commit is contained in:
parent
45f62464d3
commit
bf39c5fe4f
@ -520,19 +520,22 @@ bool cin_isscopedecl(const char_u *p)
|
||||
const size_t cinsd_len = STRLEN(curbuf->b_p_cinsd) + 1;
|
||||
char_u *cinsd_buf = xmalloc(cinsd_len);
|
||||
|
||||
bool found = false;
|
||||
|
||||
for (char_u *cinsd = curbuf->b_p_cinsd; *cinsd; ) {
|
||||
const size_t len = copy_option_part(&cinsd, cinsd_buf, cinsd_len, ",");
|
||||
if (STRNCMP(s, cinsd_buf, len) == 0) {
|
||||
const char_u *skip = cin_skipcomment(s + len);
|
||||
if (*skip == ':' && skip[1] != ':') {
|
||||
return true;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xfree(cinsd_buf);
|
||||
|
||||
return false;
|
||||
return found;
|
||||
}
|
||||
|
||||
// Maximum number of lines to search back for a "namespace" line.
|
||||
|
Loading…
Reference in New Issue
Block a user