]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Don't call FreeLibrary with NULL.
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)
According to the documentation and annotations of FreeLibrary, NULL is
not a legal value to pass. All other calls to FreeLibrary are
correctly handled.

open-vm-tools/lib/misc/machineID.c

index ef73526c32de7aabc9fcc15f701dd42c6c02a2f6..327f1b38c1b6aa4723f12f8cf1445adccb38ce63 100644 (file)
@@ -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) {