From 45d09b46cebe928693f708b777e8b11ad6ec2602 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 25 Aug 2022 09:07:04 +0800 Subject: vim-patch:8.2.3942: Coverity reports a possible memory leak Problem: Coverity reports a possible memory leak. Solution: Free the array if allocation fails. https://github.com/vim/vim/commit/8e7cc6b920ddea37deaa5e6b7b3bdfff2222d137 --- src/nvim/insexpand.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index ec885b33c3..bc02545ed8 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -2820,6 +2820,8 @@ static void get_next_spell_completion(linenr_T lnum) int num_matches = expand_spelling(lnum, (char_u *)compl_pattern, &matches); if (num_matches > 0) { ins_compl_add_matches(num_matches, matches, p_ic); + } else { + xfree(matches); } } -- cgit