summaryrefslogtreecommitdiffstats
path: root/src/insexpand.c
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 /src/insexpand.c
parentab16ad33ba10dd12ff6660fa57b88f1a30ddd8ba (diff)
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.
Diffstat (limited to 'src/insexpand.c')
-rw-r--r--src/insexpand.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/insexpand.c b/src/insexpand.c
index c5478920d5..07ac71dc49 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
}