]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Cleanup more code related to ws2_32.dll loading in src/port/getaddrinfo.c
authorMichael Paquier <michael@paquier.xyz>
Thu, 20 Feb 2020 02:57:41 +0000 (11:57 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 20 Feb 2020 02:57:41 +0000 (11:57 +0900)
e2e0219 has removed a code path for Windows 2000 that attempts to load
wship6.dll as fallback if ws2_32.dll is found but not getaddrinfo(),
leaving behind a dangling pointer as the library is freed.  However,
there is no point in this check as ws2_32.dll exists since Windows XP,
so just remove the duplicated check.

Reported-by: Tom Lane
Discussion: https://postgr.es/m/9781.1582146114@sss.pgh.pa.us

src/port/getaddrinfo.c

index c59a10fbbcd94c21ff99074c950cbe0af194a5cb..3b51eea4815e24a3ead304efdd58ea1f714b6ae2 100644 (file)
@@ -74,16 +74,6 @@ haveNativeWindowsIPv6routines(void)
         */
        hLibrary = LoadLibraryA("ws2_32");
 
-       if (hLibrary == NULL || GetProcAddress(hLibrary, "getaddrinfo") == NULL)
-       {
-               /*
-                * Well, ws2_32 doesn't exist, or more likely doesn't have
-                * getaddrinfo.
-                */
-               if (hLibrary != NULL)
-                       FreeLibrary(hLibrary);
-       }
-
        /* If hLibrary is null, we couldn't find a dll with functions */
        if (hLibrary != NULL)
        {