]> granicus.if.org Git - vim/commitdiff
patch 8.2.3942: Coverity reports a possible memory leak v8.2.3942
authorBram Moolenaar <Bram@vim.org>
Thu, 30 Dec 2021 10:32:25 +0000 (10:32 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 30 Dec 2021 10:32:25 +0000 (10:32 +0000)
Problem:    Coverity reports a possible memory leak.
Solution:   Free the array if allocation fails.

src/insexpand.c
src/version.c

index c5478920d56660c84257e16ed15fe3f656ef854b..07ac71dc497bf486d0c694a0d78222b3e56baa8a 100644 (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
 }
 
index 2a5260a04216c6b6476b1cfa37075886b8f03f52..70372a6e3493a28d3fca327a417a86df634f9543 100644 (file)
@@ -749,6 +749,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3942,
 /**/
     3941,
 /**/