[PATCH] ws2_32: add FreeAddrInfoEx

Louis Lenders xerox.xerox2000x at gmail.com
Tue Jun 16 17:43:22 CDT 2020


https://bugs.winehq.org/show_bug.cgi?id=48256

Signed-off-by: Louis Lenders <xerox.xerox2000x at gmail.com>
---
 dlls/ws2_32/socket.c    | 18 ++++++++++++++++++
 dlls/ws2_32/ws2_32.spec |  1 +
 include/ws2tcpip.h      |  4 ++++
 3 files changed, 23 insertions(+)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 199b7187a8..ac37498eca 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -7245,6 +7245,24 @@ void WINAPI FreeAddrInfoW(PADDRINFOW ai)
     }
 }
 
+/***********************************************************************
+ *      FreeAddrInfoEx      (WS2_32.@)
+ */
+void WINAPI FreeAddrInfoEx(ADDRINFOEXA *ai)
+{
+    TRACE("(%p)\n", ai);
+
+    while (ai)
+    {
+        ADDRINFOEXA *next;
+        HeapFree(GetProcessHeap(), 0, ai->ai_canonname);
+        HeapFree(GetProcessHeap(), 0, ai->ai_addr);
+        next = ai->ai_next;
+        HeapFree(GetProcessHeap(), 0, ai);
+        ai = next;
+    }
+}
+
 /***********************************************************************
  *      FreeAddrInfoExW      (WS2_32.@)
  */
diff --git a/dlls/ws2_32/ws2_32.spec b/dlls/ws2_32/ws2_32.spec
index d3c1e6214a..87e0bdfa2f 100644
--- a/dlls/ws2_32/ws2_32.spec
+++ b/dlls/ws2_32/ws2_32.spec
@@ -50,6 +50,7 @@
 
 500 stub     WEP
 
+@ stdcall FreeAddrInfoEx(ptr)
 @ stdcall FreeAddrInfoExW(ptr)
 @ stdcall FreeAddrInfoW(ptr)
 @ stdcall GetAddrInfoExCancel(ptr)
diff --git a/include/ws2tcpip.h b/include/ws2tcpip.h
index 43c277fa0c..5a444dcb5f 100644
--- a/include/ws2tcpip.h
+++ b/include/ws2tcpip.h
@@ -177,7 +177,11 @@ void WINAPI WS(freeaddrinfo)(LPADDRINFO);
 #define     FreeAddrInfoA WS(freeaddrinfo)
 void WINAPI FreeAddrInfoW(PADDRINFOW);
 #define     FreeAddrInfo WINELIB_NAME_AW(FreeAddrInfo)
+void WINAPI FreeAddrInfoEx(ADDRINFOEXA*);
 void WINAPI FreeAddrInfoExW(ADDRINFOEXW*);
+#ifdef UNICODE
+#define     FreeAddrInfoEx FreeAddrInfoExW
+#endif
 int WINAPI  WS(getaddrinfo)(const char*,const char*,const struct WS(addrinfo)*,struct WS(addrinfo)**);
 #define     GetAddrInfoA WS(getaddrinfo)
 int WINAPI  GetAddrInfoW(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*);
-- 
2.27.0




More information about the wine-devel mailing list