neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit bbad7371dbf83ec41931d1f506408dce4ef4e9b8
parent f586131e578f46165716ac047d6915ef7aa95718
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Wed, 27 Jul 2022 11:55:32 +0800

vim-patch:8.2.4625: old Coverity warning for resource leak

Problem:    Old Coverity warning for resource leak.
Solution:   Call FreeWild() if expanding matches did not fail.
https://github.com/vim/vim/commit/90da27b9277d74521202e5c146a09056696898ee

Diffstat:
Msrc/nvim/ex_cmds.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c @@ -5580,12 +5580,15 @@ static void helptags_one(char *dir, const char *ext, const char *tagfname, bool // Note: We cannot just do `&NameBuff` because it is a statically sized array // so `NameBuff == &NameBuff` according to C semantics. char *buff_list[1] = { (char *)NameBuff }; - if (gen_expand_wildcards(1, (char_u **)buff_list, &filecount, (char_u ***)&files, - EW_FILE|EW_SILENT) == FAIL - || filecount == 0) { + const int res = gen_expand_wildcards(1, (char_u **)buff_list, &filecount, (char_u ***)&files, + EW_FILE|EW_SILENT); + if (res == FAIL || filecount == 0) { if (!got_int) { semsg(_("E151: No match: %s"), NameBuff); } + if (res != FAIL) { + FreeWild(filecount, (char_u **)files); + } return; }