Mercurial > vim
changeset 28199:c8056de13879 v8.2.4625
patch 8.2.4625: old Coverity warning for resource leak
Commit: https://github.com/vim/vim/commit/90da27b9277d74521202e5c146a09056696898ee
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Mar 25 14:54:18 2022 +0000
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 25 Mar 2022 16:00:04 +0100 |
parents | 757e2258c287 |
children | 25015ad202cc |
files | src/help.c src/version.c |
diffstat | 2 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/help.c +++ b/src/help.c @@ -947,6 +947,7 @@ helptags_one( FILE *fd_tags; FILE *fd; garray_T ga; + int res; int filecount; char_u **files; char_u *p1, *p2; @@ -965,12 +966,14 @@ helptags_one( STRCPY(NameBuff, dir); STRCAT(NameBuff, "/**/*"); STRCAT(NameBuff, ext); - if (gen_expand_wildcards(1, &NameBuff, &filecount, &files, - EW_FILE|EW_SILENT) == FAIL - || filecount == 0) + res = gen_expand_wildcards(1, &NameBuff, &filecount, &files, + EW_FILE|EW_SILENT); + if (res == FAIL || filecount == 0) { if (!got_int) semsg(_(e_no_match_str_1), NameBuff); + if (res != FAIL) + FreeWild(filecount, files); return; }