Author: cgutman
Date: Thu Dec 8 19:29:20 2011
New Revision: 54616
URL:
http://svn.reactos.org/svn/reactos?rev=54616&view=rev
Log:
[WS2_32]
- Store WSAPROTOCOL_INFOW struct on the stack
Modified:
trunk/reactos/dll/win32/ws2_32/misc/ns.c
Modified: trunk/reactos/dll/win32/ws2_32/misc/ns.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/misc/ns.c…
==============================================================================
--- trunk/reactos/dll/win32/ws2_32/misc/ns.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/ws2_32/misc/ns.c [iso-8859-1] Thu Dec 8 19:29:20 2011
@@ -371,7 +371,7 @@
{
INT ret, len;
LPWSTR szTemp;
- LPWSAPROTOCOL_INFOW lpProtoInfoW = NULL;
+ WSAPROTOCOL_INFOW ProtoInfoW;
len = MultiByteToWideChar(CP_ACP,
0,
@@ -393,13 +393,7 @@
if (lpProtocolInfo)
{
- len = WSAPROTOCOL_LEN+1;
- lpProtoInfoW = HeapAlloc(GetProcessHeap(),
- 0,
- FIELD_OFFSET(WSAPROTOCOL_INFOW, szProtocol) +
- (len * sizeof(WCHAR)));
-
- memcpy(lpProtoInfoW,
+ memcpy(&ProtoInfoW,
lpProtocolInfo,
FIELD_OFFSET(WSAPROTOCOL_INFOA, szProtocol));
@@ -407,24 +401,19 @@
0,
lpProtocolInfo->szProtocol,
-1,
- lpProtoInfoW->szProtocol,
- len);
+ ProtoInfoW.szProtocol,
+ WSAPROTOCOL_LEN + 1);
}
ret = WSAStringToAddressW(szTemp,
AddressFamily,
- lpProtoInfoW,
+ &ProtoInfoW,
lpAddress,
lpAddressLength);
HeapFree(GetProcessHeap(),
0,
szTemp );
-
- if (lpProtocolInfo)
- HeapFree(GetProcessHeap(),
- 0,
- lpProtoInfoW);
WSASetLastError(ret);
return ret;