changeset 26827:3949037c47f9 v8.2.3942

patch 8.2.3942: Coverity reports a possible memory leak Commit: https://github.com/vim/vim/commit/8e7cc6b920ddea37deaa5e6b7b3bdfff2222d137 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 30 10:32:25 2021 +0000 patch 8.2.3942: Coverity reports a possible memory leak Problem: Coverity reports a possible memory leak. Solution: Free the array if allocation fails.
author Bram Moolenaar <Bram@vim.org>
date Thu, 30 Dec 2021 11:45:03 +0100
parents 4876191a71c0
children e05512129055
files src/insexpand.c src/version.c
diffstat 2 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -3193,6 +3193,8 @@ get_next_spell_completion(linenr_T lnum 
     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
 }
 
--- 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,