summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-30 10:32:25 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-30 10:32:25 +0000
commit8e7cc6b920ddea37deaa5e6b7b3bdfff2222d137 (patch)
treeee2e602e1f264c219f2e7f3bfc7628b8b6bb7e85
parentab16ad33ba10dd12ff6660fa57b88f1a30ddd8ba (diff)
downloadvim-git-8e7cc6b920ddea37deaa5e6b7b3bdfff2222d137.tar.gz
patch 8.2.3942: Coverity reports a possible memory leakv8.2.3942
Problem: Coverity reports a possible memory leak. Solution: Free the array if allocation fails.
-rw-r--r--src/insexpand.c2
-rw-r--r--src/version.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/insexpand.c b/src/insexpand.c
index c5478920d..07ac71dc4 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -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
}
diff --git a/src/version.c b/src/version.c
index 2a5260a04..70372a6e3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3942,
+/**/
3941,
/**/
3940,