0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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.
This commit is contained in:
Bram Moolenaar
2022-03-25 14:54:18 +00:00
parent 5d46dcfeed
commit 90da27b927
2 changed files with 8 additions and 3 deletions

View File

@@ -947,6 +947,7 @@ helptags_one(
FILE *fd_tags; FILE *fd_tags;
FILE *fd; FILE *fd;
garray_T ga; garray_T ga;
int res;
int filecount; int filecount;
char_u **files; char_u **files;
char_u *p1, *p2; char_u *p1, *p2;
@@ -965,12 +966,14 @@ helptags_one(
STRCPY(NameBuff, dir); STRCPY(NameBuff, dir);
STRCAT(NameBuff, "/**/*"); STRCAT(NameBuff, "/**/*");
STRCAT(NameBuff, ext); STRCAT(NameBuff, ext);
if (gen_expand_wildcards(1, &NameBuff, &filecount, &files, res = gen_expand_wildcards(1, &NameBuff, &filecount, &files,
EW_FILE|EW_SILENT) == FAIL EW_FILE|EW_SILENT);
|| filecount == 0) if (res == FAIL || filecount == 0)
{ {
if (!got_int) if (!got_int)
semsg(_(e_no_match_str_1), NameBuff); semsg(_(e_no_match_str_1), NameBuff);
if (res != FAIL)
FreeWild(filecount, files);
return; return;
} }

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
4625,
/**/ /**/
4624, 4624,
/**/ /**/