]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/file/file.c: Fix memory leak
authorJohn Wolfe <jwolfe@vmware.com>
Fri, 22 Jan 2021 20:25:41 +0000 (12:25 -0800)
committerJohn Wolfe <jwolfe@vmware.com>
Fri, 22 Jan 2021 20:25:41 +0000 (12:25 -0800)
Don't continue; jump to ensure string free.

open-vm-tools/lib/file/file.c

index 7500bbba3318a63ad9d76c27b463853b3354d1f8..c6480b4f984860083741eb53a9dd6f76f6c55236 100644 (file)
@@ -2497,27 +2497,28 @@ FileRotateByRenumber(const char *filePath,       // IN: full path to file
          const char *nr = fileList[i] + strlen(baseName) + 1;
 
          if (nrLen < 1) {  // Something must be present after the "-"
-            continue;
+            goto skip;
          }
 
          if (!isdigit(nr[0])) {  // "-' must immediately be followed by a digit
-            continue;
+            goto skip;
          }
 
          if (nr[0] == '0') {  // zero is invalid, as are leading zeros
-            continue;
+            goto skip;
          }
 
          errno = 0;
          curNr = strtoul(nr, &endNr, 10);
 
          if ((errno != 0) || (endNr - nr != nrLen)) {  // out of range; vmware-1C.log
-            continue;
+            goto skip;
          }
 
          fileNumbers[nFound++] = curNr;
       }
 
+skip:
       Posix_Free(fileList[i]);
    }