From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:46 +0000 (-0700) Subject: Don't call FreeLibrary with NULL. X-Git-Tag: stable-10.2.0~147 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3b63e7702a0c945bd9a87b24ef5cfd54574227a2;p=thirdparty%2Fopen-vm-tools.git Don't call FreeLibrary with NULL. According to the documentation and annotations of FreeLibrary, NULL is not a legal value to pass. All other calls to FreeLibrary are correctly handled. --- diff --git a/open-vm-tools/lib/misc/machineID.c b/open-vm-tools/lib/misc/machineID.c index ef73526c3..327f1b38c 100644 --- a/open-vm-tools/lib/misc/machineID.c +++ b/open-vm-tools/lib/misc/machineID.c @@ -142,7 +142,6 @@ ObtainHardwareID(uint64 *hardwareID) // OUT: // Deal with BUG 21643 dllHandle = LoadLibrary(TEXT("icmp.dll")); - FreeLibrary(dllHandle); if (!dllHandle) { Warning("%s Failed to load icmp.dll.\n", __FUNCTION__); @@ -150,6 +149,8 @@ ObtainHardwareID(uint64 *hardwareID) // OUT: return EINVAL; } + FreeLibrary(dllHandle); + dllHandle = LoadLibrary(TEXT("IpHlpApi.dll")); if (!dllHandle) {