diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-27 11:55:32 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-27 12:00:56 +0800 |
commit | bbad7371dbf83ec41931d1f506408dce4ef4e9b8 (patch) | |
tree | fbac53f3cf77c586bea562addb6f4d7deb759808 /src | |
parent | f586131e578f46165716ac047d6915ef7aa95718 (diff) | |
download | rneovim-bbad7371dbf83ec41931d1f506408dce4ef4e9b8.tar.gz rneovim-bbad7371dbf83ec41931d1f506408dce4ef4e9b8.tar.bz2 rneovim-bbad7371dbf83ec41931d1f506408dce4ef4e9b8.zip |
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 (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index ea0fa31183..c65d9359ac 100644 --- 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; } |