From: John Wolfe Date: Fri, 22 Jan 2021 20:25:41 +0000 (-0800) Subject: lib/file/file.c: Fix memory leak X-Git-Tag: stable-11.3.0~179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=741870477774566d0c065ae7f432ecda3e0caafc;p=thirdparty%2Fopen-vm-tools.git lib/file/file.c: Fix memory leak Don't continue; jump to ensure string free. --- diff --git a/open-vm-tools/lib/file/file.c b/open-vm-tools/lib/file/file.c index 7500bbba3..c6480b4f9 100644 --- a/open-vm-tools/lib/file/file.c +++ b/open-vm-tools/lib/file/file.c @@ -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]); }