patch 8.2.3942: Coverity reports a possible memory leak

Problem:    Coverity reports a possible memory leak.
Solution:   Free the array if allocation fails.
This commit is contained in:
Bram Moolenaar
2021-12-30 10:32:25 +00:00
parent ab16ad33ba
commit 8e7cc6b920
2 changed files with 4 additions and 0 deletions

View File

@ -3193,6 +3193,8 @@ get_next_spell_completion(linenr_T lnum UNUSED)
num_matches = expand_spelling(lnum, compl_pattern, &matches);
if (num_matches > 0)
ins_compl_add_matches(num_matches, matches, p_ic);
else
vim_free(matches);
#endif
}

View File

@ -749,6 +749,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3942,
/**/
3941,
/**/