comparison src/help.c @ 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 fb4c30606b4a
children 4dcccb2673fe
comparison
equal deleted inserted replaced
28198:757e2258c287 28199:c8056de13879
945 int ignore_writeerr) // ignore write error 945 int ignore_writeerr) // ignore write error
946 { 946 {
947 FILE *fd_tags; 947 FILE *fd_tags;
948 FILE *fd; 948 FILE *fd;
949 garray_T ga; 949 garray_T ga;
950 int res;
950 int filecount; 951 int filecount;
951 char_u **files; 952 char_u **files;
952 char_u *p1, *p2; 953 char_u *p1, *p2;
953 int fi; 954 int fi;
954 char_u *s; 955 char_u *s;
963 // Find all *.txt files. 964 // Find all *.txt files.
964 dirlen = (int)STRLEN(dir); 965 dirlen = (int)STRLEN(dir);
965 STRCPY(NameBuff, dir); 966 STRCPY(NameBuff, dir);
966 STRCAT(NameBuff, "/**/*"); 967 STRCAT(NameBuff, "/**/*");
967 STRCAT(NameBuff, ext); 968 STRCAT(NameBuff, ext);
968 if (gen_expand_wildcards(1, &NameBuff, &filecount, &files, 969 res = gen_expand_wildcards(1, &NameBuff, &filecount, &files,
969 EW_FILE|EW_SILENT) == FAIL 970 EW_FILE|EW_SILENT);
970 || filecount == 0) 971 if (res == FAIL || filecount == 0)
971 { 972 {
972 if (!got_int) 973 if (!got_int)
973 semsg(_(e_no_match_str_1), NameBuff); 974 semsg(_(e_no_match_str_1), NameBuff);
975 if (res != FAIL)
976 FreeWild(filecount, files);
974 return; 977 return;
975 } 978 }
976 979
977 // Open the tags file for writing. 980 // Open the tags file for writing.
978 // Do this before scanning through all the files. 981 // Do this before scanning through all the files.