diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-25 09:07:04 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-25 10:15:07 +0800 |
commit | 45d09b46cebe928693f708b777e8b11ad6ec2602 (patch) | |
tree | f208e1716ab5b8a67af0972f795a5f5a23d7b99a | |
parent | 674d3b2d5f5f7ade20cbd88ed64d63a80bb7b302 (diff) | |
download | rneovim-45d09b46cebe928693f708b777e8b11ad6ec2602.tar.gz rneovim-45d09b46cebe928693f708b777e8b11ad6ec2602.tar.bz2 rneovim-45d09b46cebe928693f708b777e8b11ad6ec2602.zip |
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
-rw-r--r-- | src/nvim/insexpand.c | 2 |
1 files changed, 2 insertions, 0 deletions
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); } } |