diff options
-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; } |