mirror of
https://github.com/neovim/neovim.git
synced 2026-08-27 09:31:47 +00:00
vim-patch:9.2.0476: pattern completion leaks memory on alloc failures (#39767)
Problem: copy_substring_from_pos() leaked on ga_grow() failures,
expand_pattern_in_buf() leaked "match" on ga_grow() failure,
fuzzy_match_str_with_pos() ignored ga_grow() failures
Solution: Route failures through cleanup paths, check ga_grow before
writing to ga_data (glepnir)
closes: vim/vim#20203
38237411e4
Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
@@ -4363,8 +4363,8 @@ static int expand_pattern_in_buf(char *pat, Direction dir, char ***matches, int
|
||||
}
|
||||
|
||||
// Extract the matching text prepended to completed word
|
||||
if (!copy_substring_from_pos(&cur_match_pos, &end_match_pos, &full_match,
|
||||
&word_end_pos)) {
|
||||
if (copy_substring_from_pos(&cur_match_pos, &end_match_pos, &full_match,
|
||||
&word_end_pos) == FAIL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user