From: Oliver Kurth Date: Tue, 27 Aug 2019 19:55:37 +0000 (-0700) Subject: Address Coverity issues reported in bora/lib/file/file.c. X-Git-Tag: stable-11.1.0~261 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ca2850b60de0f27c3f8c565d7b7e553acc2921f;p=thirdparty%2Fopen-vm-tools.git Address Coverity issues reported in bora/lib/file/file.c. Fix a minor memory leak in the function File_ExpandAndCheckDir. Also add annotations for unchecked return values in functions GetOldMachineID and File_MoveTree, so that Coverity scans of open-vm-tools will automatically classify these issues as "Intentional". These annotations are useful both for internal use as well as for partners who run Coverity scans on open-vm-tools. --- diff --git a/open-vm-tools/lib/file/file.c b/open-vm-tools/lib/file/file.c index 7dae12c88..774ec4198 100644 --- a/open-vm-tools/lib/file/file.c +++ b/open-vm-tools/lib/file/file.c @@ -558,6 +558,7 @@ GetOldMachineID(void) sizeof hardwareID); /* Base 64 encode the binary data to obtain printable characters */ + /* coverity[check_return] */ Base64_Encode(rawMachineID, sizeof rawMachineID, encodedMachineID, sizeof encodedMachineID, NULL); @@ -1437,6 +1438,7 @@ File_MoveTree(const char *srcName, // IN: * Only clean up if we created the directory. Not attempting to * clean up partial failures. */ + /* coverity[check_return] */ File_DeleteDirectoryTree(dstName); } } @@ -2186,6 +2188,7 @@ File_ExpandAndCheckDir(const char *dirName) // IN: return edirName; } + free(edirName); } return NULL;