]> granicus.if.org Git - vim/commitdiff
patch 8.2.4625: old Coverity warning for resource leak v8.2.4625
authorBram Moolenaar <Bram@vim.org>
Fri, 25 Mar 2022 14:54:18 +0000 (14:54 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 25 Mar 2022 14:54:18 +0000 (14:54 +0000)
Problem:    Old Coverity warning for resource leak.
Solution:   Call FreeWild() if expanding matches did not fail.

src/help.c
src/version.c

index 661d5b5c3c237d383966a0452d5041d5f390cce2..48178fda3bc050cb250f65214172e2cd0dfa8a24 100644 (file)
@@ -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;
     }
 
index 4a20c4665ea6fde12ff1bb31f39a376be52533b2..748a12f398e9f9de915a482da0c8921e9ed171a3 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4625,
 /**/
     4624,
 /**/