neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit bf39c5fe4fcd54f32610849b5bacd129e449729d
parent 45f62464d3e1f39e74fca627e27eea106ffe46ef
Author: Tom Praschan <13141438+tom-anders@users.noreply.github.com>
Date:   Fri,  8 Apr 2022 19:27:48 +0200

vim-patch:8.2.4703: memory leak in handling 'cinscopedecls'

Problem:    Memory leak in handling 'cinscopedecls'.
Solution:   Free the memory before returning.
https://github.com/vim/vim/commit/cb49a1d934d38cbc0d445af59b71ffe45cbcae75

Diffstat:
Msrc/nvim/indent_c.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c @@ -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.