From: Oliver Kurth Date: Sun, 21 Jul 2019 00:03:42 +0000 (-0700) Subject: Fix the memory leak in procMgr library. X-Git-Tag: stable-11.0.0~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82ef6f896c99212c9366e3e52d7767e86d9677c3;p=thirdparty%2Fopen-vm-tools.git Fix the memory leak in procMgr library. In a specific code path, procCmdAbsPath attribute is ovewritten with the new memory. This leads to a memory leak for the previously allocated memory. --- diff --git a/open-vm-tools/lib/procMgr/procMgrPosix.c b/open-vm-tools/lib/procMgr/procMgrPosix.c index 8acde5c98..980583303 100644 --- a/open-vm-tools/lib/procMgr/procMgrPosix.c +++ b/open-vm-tools/lib/procMgr/procMgrPosix.c @@ -428,7 +428,7 @@ ProcMgr_ListProcesses(void) cmdNameBegin = cmdLineTemp; } procInfo.procCmdName = Unicode_Alloc(cmdNameBegin, STRING_ENCODING_DEFAULT); - if (procInfo.procCmdAbsPath != NULL && + if (procInfo.procCmdAbsPath == NULL && cmdLineTemp[0] == '/') { procInfo.procCmdAbsPath = Unicode_Alloc(cmdLineTemp, STRING_ENCODING_DEFAULT); @@ -498,7 +498,7 @@ ProcMgr_ListProcesses(void) * Store the command name. */ procInfo.procCmdName = Unicode_Alloc(cmdLineTemp, STRING_ENCODING_DEFAULT); - if (procInfo.procCmdAbsPath != NULL && + if (procInfo.procCmdAbsPath == NULL && cmdLineTemp[0] == '/') { procInfo.procCmdAbsPath = Unicode_Alloc(cmdLineTemp, STRING_ENCODING_DEFAULT); }