vim-patch:8.2.3942: Coverity reports a possible memory leak

Problem:    Coverity reports a possible memory leak.
Solution:   Free the array if allocation fails.
8e7cc6b920
This commit is contained in:
zeertzjq 2022-08-25 09:07:04 +08:00
parent 674d3b2d5f
commit 45d09b46ce

View File

@ -2820,6 +2820,8 @@ static void get_next_spell_completion(linenr_T lnum)
int num_matches = expand_spelling(lnum, (char_u *)compl_pattern, &matches);
if (num_matches > 0) {
ins_compl_add_matches(num_matches, matches, p_ic);
} else {
xfree(matches);
}
}