]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commit
Fix memory leak in GetFormattedCommandLine() function (linuxDeployment.c)
authorOliver Kurth <okurth@vmware.com>
Thu, 28 Mar 2019 19:42:59 +0000 (12:42 -0700)
committerOliver Kurth <okurth@vmware.com>
Thu, 28 Mar 2019 19:42:59 +0000 (12:42 -0700)
commitd93219282ff7e89e3f581bf757dfd807c7568452
tree87fddfacd53848232bd30f587071e4cbd5857158
parent85f0733565333335aac4c45851013e8e0901a9f5
Fix memory leak in GetFormattedCommandLine() function (linuxDeployment.c)

1. There are malloc() calls happening in a loop; this function returns
   NULL when one of malloc fails.  If a malloc call fails in the loop,
   all memory allocated in previous iterations should be freed before
   the return NULL.
2. Clear allocated resources before return NULL in this file.
3. Add NULL check following malloc calls in this file.
4. Encapsulate %s in () only if %s is strerror(errno), otherwise encapsulate
   %s in single quotes.
5. End with \n in sLog.
open-vm-tools/libDeployPkg/linuxDeployment.c