Commit 357fb2be authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ws2_32: Use malloc() instead of HeapAlloc().

parent a3bbf513
...@@ -34,15 +34,7 @@ ...@@ -34,15 +34,7 @@
* whole stuff did not work anyway to other changes). * whole stuff did not work anyway to other changes).
*/ */
#include <stdarg.h> #include "ws2_32_private.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winsock2.h"
#include "ws2spi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(winsock); WINE_DEFAULT_DEBUG_CHANNEL(winsock);
...@@ -253,7 +245,7 @@ static void WINAPI async_worker( TP_CALLBACK_INSTANCE *instance, void *context ) ...@@ -253,7 +245,7 @@ static void WINAPI async_worker( TP_CALLBACK_INSTANCE *instance, void *context )
struct async_query_header *query = context; struct async_query_header *query = context;
LPARAM lparam = query->func( query ); LPARAM lparam = query->func( query );
PostMessageW( query->hWnd, query->uMsg, (WPARAM)query->handle, lparam ); PostMessageW( query->hWnd, query->uMsg, (WPARAM)query->handle, lparam );
HeapFree( GetProcessHeap(), 0, query ); free( query );
} }
...@@ -283,7 +275,7 @@ static HANDLE run_query( HWND hWnd, UINT uMsg, LPARAM (*func)(struct async_query ...@@ -283,7 +275,7 @@ static HANDLE run_query( HWND hWnd, UINT uMsg, LPARAM (*func)(struct async_query
if (!TrySubmitThreadpoolCallback( async_worker, query, NULL )) if (!TrySubmitThreadpoolCallback( async_worker, query, NULL ))
{ {
SetLastError( WSAEWOULDBLOCK ); SetLastError( WSAEWOULDBLOCK );
HeapFree( GetProcessHeap(), 0, query ); free( query );
return 0; return 0;
} }
return UlongToHandle( handle ); return UlongToHandle( handle );
...@@ -300,7 +292,7 @@ HANDLE WINAPI WSAAsyncGetHostByAddr(HWND hWnd, UINT uMsg, LPCSTR addr, ...@@ -300,7 +292,7 @@ HANDLE WINAPI WSAAsyncGetHostByAddr(HWND hWnd, UINT uMsg, LPCSTR addr,
TRACE("hwnd %p, msg %04x, addr %p[%i]\n", hWnd, uMsg, addr, len ); TRACE("hwnd %p, msg %04x, addr %p[%i]\n", hWnd, uMsg, addr, len );
if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) if (!(aq = malloc( sizeof(*aq) + len )))
{ {
SetLastError( WSAEWOULDBLOCK ); SetLastError( WSAEWOULDBLOCK );
return 0; return 0;
...@@ -323,7 +315,7 @@ HANDLE WINAPI WSAAsyncGetHostByName(HWND hWnd, UINT uMsg, LPCSTR name, ...@@ -323,7 +315,7 @@ HANDLE WINAPI WSAAsyncGetHostByName(HWND hWnd, UINT uMsg, LPCSTR name,
TRACE("hwnd %p, msg %04x, host %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen ); TRACE("hwnd %p, msg %04x, host %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen );
if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) if (!(aq = malloc( sizeof(*aq) + len )))
{ {
SetLastError( WSAEWOULDBLOCK ); SetLastError( WSAEWOULDBLOCK );
return 0; return 0;
...@@ -344,7 +336,7 @@ HANDLE WINAPI WSAAsyncGetProtoByName(HWND hWnd, UINT uMsg, LPCSTR name, ...@@ -344,7 +336,7 @@ HANDLE WINAPI WSAAsyncGetProtoByName(HWND hWnd, UINT uMsg, LPCSTR name,
TRACE("hwnd %p, msg %04x, proto %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen ); TRACE("hwnd %p, msg %04x, proto %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen );
if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) if (!(aq = malloc( sizeof(*aq) + len )))
{ {
SetLastError( WSAEWOULDBLOCK ); SetLastError( WSAEWOULDBLOCK );
return 0; return 0;
...@@ -365,7 +357,7 @@ HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND hWnd, UINT uMsg, INT number, ...@@ -365,7 +357,7 @@ HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND hWnd, UINT uMsg, INT number,
TRACE("hwnd %p, msg %04x, num %i\n", hWnd, uMsg, number ); TRACE("hwnd %p, msg %04x, num %i\n", hWnd, uMsg, number );
if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) ))) if (!(aq = malloc( sizeof(*aq) )))
{ {
SetLastError( WSAEWOULDBLOCK ); SetLastError( WSAEWOULDBLOCK );
return 0; return 0;
...@@ -386,7 +378,7 @@ HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name, ...@@ -386,7 +378,7 @@ HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name,
TRACE("hwnd %p, msg %04x, name %s, proto %s\n", hWnd, uMsg, debugstr_a(name), debugstr_a(proto)); TRACE("hwnd %p, msg %04x, name %s, proto %s\n", hWnd, uMsg, debugstr_a(name), debugstr_a(proto));
if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len1 + len2 ))) if (!(aq = malloc( sizeof(*aq) + len1 + len2 )))
{ {
SetLastError( WSAEWOULDBLOCK ); SetLastError( WSAEWOULDBLOCK );
return 0; return 0;
...@@ -417,7 +409,7 @@ HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port, ...@@ -417,7 +409,7 @@ HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port,
TRACE("hwnd %p, msg %04x, port %i, proto %s\n", hWnd, uMsg, port, debugstr_a(proto)); TRACE("hwnd %p, msg %04x, port %i, proto %s\n", hWnd, uMsg, port, debugstr_a(proto));
if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) if (!(aq = malloc( sizeof(*aq) + len )))
{ {
SetLastError( WSAEWOULDBLOCK ); SetLastError( WSAEWOULDBLOCK );
return 0; return 0;
......
...@@ -38,10 +38,10 @@ static char *get_fqdn(void) ...@@ -38,10 +38,10 @@ static char *get_fqdn(void)
GetComputerNameExA( ComputerNamePhysicalDnsFullyQualified, NULL, &size ); GetComputerNameExA( ComputerNamePhysicalDnsFullyQualified, NULL, &size );
if (GetLastError() != ERROR_MORE_DATA) return NULL; if (GetLastError() != ERROR_MORE_DATA) return NULL;
if (!(ret = HeapAlloc( GetProcessHeap(), 0, size ))) return NULL; if (!(ret = malloc( size ))) return NULL;
if (!GetComputerNameExA( ComputerNamePhysicalDnsFullyQualified, ret, &size )) if (!GetComputerNameExA( ComputerNamePhysicalDnsFullyQualified, ret, &size ))
{ {
HeapFree( GetProcessHeap(), 0, ret ); free( ret );
return NULL; return NULL;
} }
return ret; return ret;
...@@ -57,14 +57,14 @@ static int do_getaddrinfo( const char *node, const char *service, ...@@ -57,14 +57,14 @@ static int do_getaddrinfo( const char *node, const char *service,
for (;;) for (;;)
{ {
if (!(params.info = HeapAlloc( GetProcessHeap(), 0, size ))) if (!(params.info = malloc( size )))
return WSA_NOT_ENOUGH_MEMORY; return WSA_NOT_ENOUGH_MEMORY;
if (!(ret = WS_CALL( getaddrinfo, &params ))) if (!(ret = WS_CALL( getaddrinfo, &params )))
{ {
*info = params.info; *info = params.info;
return ret; return ret;
} }
HeapFree( GetProcessHeap(), 0, params.info ); free( params.info );
if (ret != ERROR_INSUFFICIENT_BUFFER) return ret; if (ret != ERROR_INSUFFICIENT_BUFFER) return ret;
} }
} }
...@@ -103,8 +103,8 @@ int WINAPI getaddrinfo( const char *node, const char *service, ...@@ -103,8 +103,8 @@ int WINAPI getaddrinfo( const char *node, const char *service,
if (node[0] == '[' && (close_bracket = strchr(node + 1, ']'))) if (node[0] == '[' && (close_bracket = strchr(node + 1, ']')))
{ {
nodev6 = HeapAlloc( GetProcessHeap(), 0, close_bracket - node ); if (!(nodev6 = malloc( close_bracket - node )))
if (!nodev6) return WSA_NOT_ENOUGH_MEMORY; return WSA_NOT_ENOUGH_MEMORY;
lstrcpynA( nodev6, node + 1, close_bracket - node ); lstrcpynA( nodev6, node + 1, close_bracket - node );
node = nodev6; node = nodev6;
} }
...@@ -117,7 +117,7 @@ int WINAPI getaddrinfo( const char *node, const char *service, ...@@ -117,7 +117,7 @@ int WINAPI getaddrinfo( const char *node, const char *service,
{ {
if (!fqdn && !(fqdn = get_fqdn())) if (!fqdn && !(fqdn = get_fqdn()))
{ {
HeapFree( GetProcessHeap(), 0, nodev6 ); free( nodev6 );
return WSA_NOT_ENOUGH_MEMORY; return WSA_NOT_ENOUGH_MEMORY;
} }
if (!strcmp( fqdn, node ) || (!strncmp( fqdn, node, strlen( node ) ) && fqdn[strlen( node )] == '.')) if (!strcmp( fqdn, node ) || (!strncmp( fqdn, node, strlen( node ) ) && fqdn[strlen( node )] == '.'))
...@@ -136,8 +136,8 @@ int WINAPI getaddrinfo( const char *node, const char *service, ...@@ -136,8 +136,8 @@ int WINAPI getaddrinfo( const char *node, const char *service,
} }
} }
HeapFree( GetProcessHeap(), 0, fqdn ); free( fqdn );
HeapFree( GetProcessHeap(), 0, nodev6 ); free( nodev6 );
if (!ret && TRACE_ON(winsock)) if (!ret && TRACE_ON(winsock))
{ {
...@@ -160,7 +160,7 @@ static ADDRINFOEXW *addrinfo_AtoW( const struct addrinfo *ai ) ...@@ -160,7 +160,7 @@ static ADDRINFOEXW *addrinfo_AtoW( const struct addrinfo *ai )
{ {
ADDRINFOEXW *ret; ADDRINFOEXW *ret;
if (!(ret = HeapAlloc( GetProcessHeap(), 0, sizeof(ADDRINFOEXW) ))) return NULL; if (!(ret = malloc( sizeof(ADDRINFOEXW) ))) return NULL;
ret->ai_flags = ai->ai_flags; ret->ai_flags = ai->ai_flags;
ret->ai_family = ai->ai_family; ret->ai_family = ai->ai_family;
ret->ai_socktype = ai->ai_socktype; ret->ai_socktype = ai->ai_socktype;
...@@ -175,19 +175,19 @@ static ADDRINFOEXW *addrinfo_AtoW( const struct addrinfo *ai ) ...@@ -175,19 +175,19 @@ static ADDRINFOEXW *addrinfo_AtoW( const struct addrinfo *ai )
if (ai->ai_canonname) if (ai->ai_canonname)
{ {
int len = MultiByteToWideChar( CP_ACP, 0, ai->ai_canonname, -1, NULL, 0 ); int len = MultiByteToWideChar( CP_ACP, 0, ai->ai_canonname, -1, NULL, 0 );
if (!(ret->ai_canonname = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) if (!(ret->ai_canonname = malloc( len * sizeof(WCHAR) )))
{ {
HeapFree( GetProcessHeap(), 0, ret ); free( ret );
return NULL; return NULL;
} }
MultiByteToWideChar( CP_ACP, 0, ai->ai_canonname, -1, ret->ai_canonname, len ); MultiByteToWideChar( CP_ACP, 0, ai->ai_canonname, -1, ret->ai_canonname, len );
} }
if (ai->ai_addr) if (ai->ai_addr)
{ {
if (!(ret->ai_addr = HeapAlloc( GetProcessHeap(), 0, ai->ai_addrlen ))) if (!(ret->ai_addr = malloc( ai->ai_addrlen )))
{ {
HeapFree( GetProcessHeap(), 0, ret->ai_canonname ); free( ret->ai_canonname );
HeapFree( GetProcessHeap(), 0, ret ); free( ret );
return NULL; return NULL;
} }
memcpy( ret->ai_addr, ai->ai_addr, ai->ai_addrlen ); memcpy( ret->ai_addr, ai->ai_addr, ai->ai_addrlen );
...@@ -217,7 +217,7 @@ static struct addrinfo *addrinfo_WtoA( const struct addrinfoW *ai ) ...@@ -217,7 +217,7 @@ static struct addrinfo *addrinfo_WtoA( const struct addrinfoW *ai )
{ {
struct addrinfo *ret; struct addrinfo *ret;
if (!(ret = HeapAlloc( GetProcessHeap(), 0, sizeof(struct addrinfo) ))) return NULL; if (!(ret = malloc( sizeof(struct addrinfo) ))) return NULL;
ret->ai_flags = ai->ai_flags; ret->ai_flags = ai->ai_flags;
ret->ai_family = ai->ai_family; ret->ai_family = ai->ai_family;
ret->ai_socktype = ai->ai_socktype; ret->ai_socktype = ai->ai_socktype;
...@@ -229,19 +229,19 @@ static struct addrinfo *addrinfo_WtoA( const struct addrinfoW *ai ) ...@@ -229,19 +229,19 @@ static struct addrinfo *addrinfo_WtoA( const struct addrinfoW *ai )
if (ai->ai_canonname) if (ai->ai_canonname)
{ {
int len = WideCharToMultiByte( CP_ACP, 0, ai->ai_canonname, -1, NULL, 0, NULL, NULL ); int len = WideCharToMultiByte( CP_ACP, 0, ai->ai_canonname, -1, NULL, 0, NULL, NULL );
if (!(ret->ai_canonname = HeapAlloc( GetProcessHeap(), 0, len ))) if (!(ret->ai_canonname = malloc( len )))
{ {
HeapFree( GetProcessHeap(), 0, ret ); free( ret );
return NULL; return NULL;
} }
WideCharToMultiByte( CP_ACP, 0, ai->ai_canonname, -1, ret->ai_canonname, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, ai->ai_canonname, -1, ret->ai_canonname, len, NULL, NULL );
} }
if (ai->ai_addr) if (ai->ai_addr)
{ {
if (!(ret->ai_addr = HeapAlloc( GetProcessHeap(), 0, sizeof(struct sockaddr) ))) if (!(ret->ai_addr = malloc( sizeof(struct sockaddr) )))
{ {
HeapFree( GetProcessHeap(), 0, ret->ai_canonname ); free( ret->ai_canonname );
HeapFree( GetProcessHeap(), 0, ret ); free( ret );
return NULL; return NULL;
} }
memcpy( ret->ai_addr, ai->ai_addr, sizeof(struct sockaddr) ); memcpy( ret->ai_addr, ai->ai_addr, sizeof(struct sockaddr) );
...@@ -276,9 +276,9 @@ static void WINAPI getaddrinfo_callback(TP_CALLBACK_INSTANCE *instance, void *co ...@@ -276,9 +276,9 @@ static void WINAPI getaddrinfo_callback(TP_CALLBACK_INSTANCE *instance, void *co
freeaddrinfo(res); freeaddrinfo(res);
} }
HeapFree( GetProcessHeap(), 0, args->nodename ); free( args->nodename );
HeapFree( GetProcessHeap(), 0, args->servname ); free( args->servname );
HeapFree( GetProcessHeap(), 0, args ); free( args );
overlapped->Internal = ret; overlapped->Internal = ret;
if (completion_routine) completion_routine( ret, 0, overlapped ); if (completion_routine) completion_routine( ret, 0, overlapped );
...@@ -322,20 +322,20 @@ static int getaddrinfoW( const WCHAR *nodename, const WCHAR *servname, ...@@ -322,20 +322,20 @@ static int getaddrinfoW( const WCHAR *nodename, const WCHAR *servname,
ret = EAI_FAIL; ret = EAI_FAIL;
goto end; goto end;
} }
if (!(local_nodenameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) goto end; if (!(local_nodenameW = malloc( len * sizeof(WCHAR) ))) goto end;
IdnToAscii( 0, nodename, -1, local_nodenameW, len ); IdnToAscii( 0, nodename, -1, local_nodenameW, len );
} }
} }
if (local_nodenameW) if (local_nodenameW)
{ {
len = WideCharToMultiByte( CP_ACP, 0, local_nodenameW, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, local_nodenameW, -1, NULL, 0, NULL, NULL );
if (!(nodenameA = HeapAlloc( GetProcessHeap(), 0, len ))) goto end; if (!(nodenameA = malloc( len ))) goto end;
WideCharToMultiByte( CP_ACP, 0, local_nodenameW, -1, nodenameA, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, local_nodenameW, -1, nodenameA, len, NULL, NULL );
} }
if (servname) if (servname)
{ {
len = WideCharToMultiByte( CP_ACP, 0, servname, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, servname, -1, NULL, 0, NULL, NULL );
if (!(servnameA = HeapAlloc( GetProcessHeap(), 0, len ))) goto end; if (!(servnameA = malloc( len ))) goto end;
WideCharToMultiByte( CP_ACP, 0, servname, -1, servnameA, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, servname, -1, servnameA, len, NULL, NULL );
} }
...@@ -349,7 +349,7 @@ static int getaddrinfoW( const WCHAR *nodename, const WCHAR *servname, ...@@ -349,7 +349,7 @@ static int getaddrinfoW( const WCHAR *nodename, const WCHAR *servname,
goto end; goto end;
} }
if (!(args = HeapAlloc( GetProcessHeap(), 0, sizeof(*args) + sizeof(*args->hints) ))) goto end; if (!(args = malloc( sizeof(*args) + sizeof(*args->hints) ))) goto end;
args->overlapped = overlapped; args->overlapped = overlapped;
args->completion_routine = completion_routine; args->completion_routine = completion_routine;
args->result = res; args->result = res;
...@@ -368,13 +368,13 @@ static int getaddrinfoW( const WCHAR *nodename, const WCHAR *servname, ...@@ -368,13 +368,13 @@ static int getaddrinfoW( const WCHAR *nodename, const WCHAR *servname,
overlapped->Internal = WSAEINPROGRESS; overlapped->Internal = WSAEINPROGRESS;
if (!TrySubmitThreadpoolCallback( getaddrinfo_callback, args, NULL )) if (!TrySubmitThreadpoolCallback( getaddrinfo_callback, args, NULL ))
{ {
HeapFree( GetProcessHeap(), 0, args ); free( args );
ret = GetLastError(); ret = GetLastError();
goto end; goto end;
} }
if (local_nodenameW != nodename) if (local_nodenameW != nodename)
HeapFree( GetProcessHeap(), 0, local_nodenameW ); free( local_nodenameW );
SetLastError( ERROR_IO_PENDING ); SetLastError( ERROR_IO_PENDING );
return ERROR_IO_PENDING; return ERROR_IO_PENDING;
} }
...@@ -388,9 +388,9 @@ static int getaddrinfoW( const WCHAR *nodename, const WCHAR *servname, ...@@ -388,9 +388,9 @@ static int getaddrinfoW( const WCHAR *nodename, const WCHAR *servname,
end: end:
if (local_nodenameW != nodename) if (local_nodenameW != nodename)
HeapFree( GetProcessHeap(), 0, local_nodenameW ); free( local_nodenameW );
HeapFree( GetProcessHeap(), 0, nodenameA ); free( nodenameA );
HeapFree( GetProcessHeap(), 0, servnameA ); free( servnameA );
return ret; return ret;
} }
...@@ -484,7 +484,7 @@ void WINAPI freeaddrinfo( struct addrinfo *info ) ...@@ -484,7 +484,7 @@ void WINAPI freeaddrinfo( struct addrinfo *info )
{ {
TRACE( "%p\n", info ); TRACE( "%p\n", info );
HeapFree( GetProcessHeap(), 0, info ); free( info );
} }
...@@ -496,10 +496,10 @@ void WINAPI FreeAddrInfoW( ADDRINFOW *ai ) ...@@ -496,10 +496,10 @@ void WINAPI FreeAddrInfoW( ADDRINFOW *ai )
while (ai) while (ai)
{ {
ADDRINFOW *next; ADDRINFOW *next;
HeapFree( GetProcessHeap(), 0, ai->ai_canonname ); free( ai->ai_canonname );
HeapFree( GetProcessHeap(), 0, ai->ai_addr ); free( ai->ai_addr );
next = ai->ai_next; next = ai->ai_next;
HeapFree( GetProcessHeap(), 0, ai ); free( ai );
ai = next; ai = next;
} }
} }
...@@ -515,10 +515,10 @@ void WINAPI FreeAddrInfoEx( ADDRINFOEXA *ai ) ...@@ -515,10 +515,10 @@ void WINAPI FreeAddrInfoEx( ADDRINFOEXA *ai )
while (ai) while (ai)
{ {
ADDRINFOEXA *next; ADDRINFOEXA *next;
HeapFree( GetProcessHeap(), 0, ai->ai_canonname ); free( ai->ai_canonname );
HeapFree( GetProcessHeap(), 0, ai->ai_addr ); free( ai->ai_addr );
next = ai->ai_next; next = ai->ai_next;
HeapFree( GetProcessHeap(), 0, ai ); free( ai );
ai = next; ai = next;
} }
} }
...@@ -534,10 +534,10 @@ void WINAPI FreeAddrInfoExW( ADDRINFOEXW *ai ) ...@@ -534,10 +534,10 @@ void WINAPI FreeAddrInfoExW( ADDRINFOEXW *ai )
while (ai) while (ai)
{ {
ADDRINFOEXW *next; ADDRINFOEXW *next;
HeapFree( GetProcessHeap(), 0, ai->ai_canonname ); free( ai->ai_canonname );
HeapFree( GetProcessHeap(), 0, ai->ai_addr ); free( ai->ai_addr );
next = ai->ai_next; next = ai->ai_next;
HeapFree( GetProcessHeap(), 0, ai ); free( ai );
ai = next; ai = next;
} }
} }
...@@ -567,11 +567,11 @@ int WINAPI GetNameInfoW( const SOCKADDR *addr, socklen_t addr_len, WCHAR *host, ...@@ -567,11 +567,11 @@ int WINAPI GetNameInfoW( const SOCKADDR *addr, socklen_t addr_len, WCHAR *host,
int ret; int ret;
char *hostA = NULL, *servA = NULL; char *hostA = NULL, *servA = NULL;
if (host && (!(hostA = HeapAlloc( GetProcessHeap(), 0, host_len )))) if (host && !(hostA = malloc( host_len )))
return EAI_MEMORY; return EAI_MEMORY;
if (serv && (!(servA = HeapAlloc( GetProcessHeap(), 0, serv_len )))) if (serv && !(servA = malloc( serv_len )))
{ {
HeapFree( GetProcessHeap(), 0, hostA ); free( hostA );
return EAI_MEMORY; return EAI_MEMORY;
} }
...@@ -582,8 +582,8 @@ int WINAPI GetNameInfoW( const SOCKADDR *addr, socklen_t addr_len, WCHAR *host, ...@@ -582,8 +582,8 @@ int WINAPI GetNameInfoW( const SOCKADDR *addr, socklen_t addr_len, WCHAR *host,
if (serv) MultiByteToWideChar( CP_ACP, 0, servA, -1, serv, serv_len ); if (serv) MultiByteToWideChar( CP_ACP, 0, servA, -1, serv, serv_len );
} }
HeapFree( GetProcessHeap(), 0, hostA ); free( hostA );
HeapFree( GetProcessHeap(), 0, servA ); free( servA );
return ret; return ret;
} }
...@@ -594,9 +594,9 @@ static struct hostent *get_hostent_buffer( unsigned int size ) ...@@ -594,9 +594,9 @@ static struct hostent *get_hostent_buffer( unsigned int size )
if (data->he_buffer) if (data->he_buffer)
{ {
if (data->he_len >= size) return data->he_buffer; if (data->he_len >= size) return data->he_buffer;
HeapFree( GetProcessHeap(), 0, data->he_buffer ); free( data->he_buffer );
} }
data->he_buffer = HeapAlloc( GetProcessHeap(), 0, (data->he_len = size) ); data->he_buffer = malloc( (data->he_len = size) );
if (!data->he_buffer) SetLastError(WSAENOBUFS); if (!data->he_buffer) SetLastError(WSAENOBUFS);
return data->he_buffer; return data->he_buffer;
} }
...@@ -722,8 +722,8 @@ static struct hostent *get_local_ips( char *hostname ) ...@@ -722,8 +722,8 @@ static struct hostent *get_local_ips( char *hostname )
if (GetIpForwardTable( NULL, &route_size, FALSE ) != ERROR_INSUFFICIENT_BUFFER) if (GetIpForwardTable( NULL, &route_size, FALSE ) != ERROR_INSUFFICIENT_BUFFER)
return NULL; return NULL;
adapters = HeapAlloc( GetProcessHeap(), 0, adap_size ); adapters = malloc( adap_size );
routes = HeapAlloc( GetProcessHeap(), 0, route_size ); routes = malloc( route_size );
if (!adapters || !routes) if (!adapters || !routes)
goto cleanup; goto cleanup;
...@@ -759,7 +759,7 @@ static struct hostent *get_local_ips( char *hostname ) ...@@ -759,7 +759,7 @@ static struct hostent *get_local_ips( char *hostname )
} }
if (exists) if (exists)
continue; continue;
route_addrs = heap_realloc( route_addrs, (numroutes + 1) * sizeof(struct route) ); route_addrs = realloc( route_addrs, (numroutes + 1) * sizeof(struct route) );
if (!route_addrs) if (!route_addrs)
goto cleanup; goto cleanup;
route_addrs[numroutes].interface = ifindex; route_addrs[numroutes].interface = ifindex;
...@@ -808,9 +808,9 @@ static struct hostent *get_local_ips( char *hostname ) ...@@ -808,9 +808,9 @@ static struct hostent *get_local_ips( char *hostname )
*(struct in_addr *)hostlist->h_addr_list[i] = route_addrs[i].addr; *(struct in_addr *)hostlist->h_addr_list[i] = route_addrs[i].addr;
cleanup: cleanup:
HeapFree( GetProcessHeap(), 0, route_addrs ); free( route_addrs );
HeapFree( GetProcessHeap(), 0, adapters ); free( adapters );
HeapFree( GetProcessHeap(), 0, routes ); free( routes );
return hostlist; return hostlist;
} }
...@@ -974,11 +974,10 @@ static char *read_etc_file( const WCHAR *filename, DWORD *ret_size ) ...@@ -974,11 +974,10 @@ static char *read_etc_file( const WCHAR *filename, DWORD *ret_size )
} }
size = GetFileSize( file, NULL ); size = GetFileSize( file, NULL );
if (!(data = HeapAlloc( GetProcessHeap(), 0, size )) || if (!(data = malloc( size )) || !ReadFile( file, data, size, ret_size, NULL ))
!ReadFile( file, data, size, ret_size, NULL ))
{ {
WARN( "failed to read file, error %u\n", GetLastError() ); WARN( "failed to read file, error %u\n", GetLastError() );
HeapFree( GetProcessHeap(), 0, data ); free( data );
data = NULL; data = NULL;
} }
CloseHandle( file ); CloseHandle( file );
...@@ -1009,10 +1008,10 @@ static struct protoent *get_protoent_buffer( unsigned int size ) ...@@ -1009,10 +1008,10 @@ static struct protoent *get_protoent_buffer( unsigned int size )
if (data->pe_buffer) if (data->pe_buffer)
{ {
if (data->pe_len >= size) return data->pe_buffer; if (data->pe_len >= size) return data->pe_buffer;
HeapFree( GetProcessHeap(), 0, data->pe_buffer ); free( data->pe_buffer );
} }
data->pe_len = size; data->pe_len = size;
data->pe_buffer = HeapAlloc( GetProcessHeap(), 0, size ); data->pe_buffer = malloc( size );
if (!data->pe_buffer) SetLastError( WSAENOBUFS ); if (!data->pe_buffer) SetLastError( WSAENOBUFS );
return data->pe_buffer; return data->pe_buffer;
} }
...@@ -1150,7 +1149,7 @@ struct protoent * WINAPI getprotobyname( const char *name ) ...@@ -1150,7 +1149,7 @@ struct protoent * WINAPI getprotobyname( const char *name )
break; break;
} }
HeapFree( GetProcessHeap(), 0, file ); free( file );
return proto; return proto;
} }
...@@ -1180,7 +1179,7 @@ struct protoent * WINAPI getprotobynumber( int number ) ...@@ -1180,7 +1179,7 @@ struct protoent * WINAPI getprotobynumber( int number )
break; break;
} }
HeapFree( GetProcessHeap(), 0, file ); free( file );
return proto; return proto;
} }
...@@ -1191,10 +1190,10 @@ static struct servent *get_servent_buffer( int size ) ...@@ -1191,10 +1190,10 @@ static struct servent *get_servent_buffer( int size )
if (data->se_buffer) if (data->se_buffer)
{ {
if (data->se_len >= size) return data->se_buffer; if (data->se_len >= size) return data->se_buffer;
HeapFree( GetProcessHeap(), 0, data->se_buffer ); free( data->se_buffer );
} }
data->se_len = size; data->se_len = size;
data->se_buffer = HeapAlloc( GetProcessHeap(), 0, size ); data->se_buffer = malloc( size );
if (!data->se_buffer) SetLastError( WSAENOBUFS ); if (!data->se_buffer) SetLastError( WSAENOBUFS );
return data->se_buffer; return data->se_buffer;
} }
...@@ -1341,7 +1340,7 @@ struct servent * WINAPI getservbyname( const char *name, const char *proto ) ...@@ -1341,7 +1340,7 @@ struct servent * WINAPI getservbyname( const char *name, const char *proto )
break; break;
} }
HeapFree( GetProcessHeap(), 0, file ); free( file );
return serv; return serv;
} }
...@@ -1371,7 +1370,7 @@ struct servent * WINAPI getservbyport( int port, const char *proto ) ...@@ -1371,7 +1370,7 @@ struct servent * WINAPI getservbyport( int port, const char *proto )
break; break;
} }
HeapFree( GetProcessHeap(), 0, file ); free( file );
return serv; return serv;
} }
...@@ -1481,7 +1480,7 @@ int WINAPI InetPtonW( int family, const WCHAR *addr, void *buffer ) ...@@ -1481,7 +1480,7 @@ int WINAPI InetPtonW( int family, const WCHAR *addr, void *buffer )
} }
len = WideCharToMultiByte( CP_ACP, 0, addr, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, addr, -1, NULL, 0, NULL, NULL );
if (!(addrA = HeapAlloc( GetProcessHeap(), 0, len ))) if (!(addrA = malloc( len )))
{ {
SetLastError( WSA_NOT_ENOUGH_MEMORY ); SetLastError( WSA_NOT_ENOUGH_MEMORY );
return -1; return -1;
...@@ -1491,7 +1490,7 @@ int WINAPI InetPtonW( int family, const WCHAR *addr, void *buffer ) ...@@ -1491,7 +1490,7 @@ int WINAPI InetPtonW( int family, const WCHAR *addr, void *buffer )
ret = inet_pton( family, addrA, buffer ); ret = inet_pton( family, addrA, buffer );
if (!ret) SetLastError( WSAEINVAL ); if (!ret) SetLastError( WSAEINVAL );
HeapFree( GetProcessHeap(), 0, addrA ); free( addrA );
return ret; return ret;
} }
...@@ -1627,14 +1626,14 @@ int WINAPI WSAStringToAddressW( WCHAR *string, int family, WSAPROTOCOL_INFOW *pr ...@@ -1627,14 +1626,14 @@ int WINAPI WSAStringToAddressW( WCHAR *string, int family, WSAPROTOCOL_INFOW *pr
} }
sizeA = WideCharToMultiByte( CP_ACP, 0, string, -1, NULL, 0, NULL, NULL ); sizeA = WideCharToMultiByte( CP_ACP, 0, string, -1, NULL, 0, NULL, NULL );
if (!(stringA = HeapAlloc( GetProcessHeap(), 0, sizeA ))) if (!(stringA = malloc( sizeA )))
{ {
SetLastError( WSA_NOT_ENOUGH_MEMORY ); SetLastError( WSA_NOT_ENOUGH_MEMORY );
return -1; return -1;
} }
WideCharToMultiByte( CP_ACP, 0, string, -1, stringA, sizeA, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, string, -1, stringA, sizeA, NULL, NULL );
ret = WSAStringToAddressA( stringA, family, protocol_infoA, addr, addr_len ); ret = WSAStringToAddressA( stringA, family, protocol_infoA, addr, addr_len );
HeapFree( GetProcessHeap(), 0, stringA ); free( stringA );
return ret; return ret;
} }
......
...@@ -361,7 +361,7 @@ static BOOL socket_list_add(SOCKET socket) ...@@ -361,7 +361,7 @@ static BOOL socket_list_add(SOCKET socket)
} }
} }
new_size = max(socket_list_size * 2, 8); new_size = max(socket_list_size * 2, 8);
if (!(new_array = heap_realloc(socket_list, new_size * sizeof(*socket_list)))) if (!(new_array = realloc( socket_list, new_size * sizeof(*socket_list) )))
{ {
LeaveCriticalSection(&cs_socket_list); LeaveCriticalSection(&cs_socket_list);
return FALSE; return FALSE;
...@@ -508,30 +508,30 @@ static DWORD NtStatusToWSAError( NTSTATUS status ) ...@@ -508,30 +508,30 @@ static DWORD NtStatusToWSAError( NTSTATUS status )
struct per_thread_data *get_per_thread_data(void) struct per_thread_data *get_per_thread_data(void)
{ {
struct per_thread_data * ptb = NtCurrentTeb()->WinSockData; struct per_thread_data *data = NtCurrentTeb()->WinSockData;
/* lazy initialization */
if (!ptb) if (!data)
{ {
ptb = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ptb) ); data = calloc( 1, sizeof(*data) );
NtCurrentTeb()->WinSockData = ptb; NtCurrentTeb()->WinSockData = data;
} }
return ptb; return data;
} }
static void free_per_thread_data(void) static void free_per_thread_data(void)
{ {
struct per_thread_data * ptb = NtCurrentTeb()->WinSockData; struct per_thread_data *data = NtCurrentTeb()->WinSockData;
if (!ptb) return; if (!data) return;
CloseHandle( ptb->sync_event ); CloseHandle( data->sync_event );
/* delete scratch buffers */ /* delete scratch buffers */
HeapFree( GetProcessHeap(), 0, ptb->he_buffer ); free( data->he_buffer );
HeapFree( GetProcessHeap(), 0, ptb->se_buffer ); free( data->se_buffer );
HeapFree( GetProcessHeap(), 0, ptb->pe_buffer ); free( data->pe_buffer );
HeapFree( GetProcessHeap(), 0, ptb ); free( data );
NtCurrentTeb()->WinSockData = NULL; NtCurrentTeb()->WinSockData = NULL;
} }
...@@ -1108,12 +1108,12 @@ int WINAPI bind( SOCKET s, const struct sockaddr *addr, int len ) ...@@ -1108,12 +1108,12 @@ int WINAPI bind( SOCKET s, const struct sockaddr *addr, int len )
if (!(sync_event = get_sync_event())) return -1; if (!(sync_event = get_sync_event())) return -1;
params = HeapAlloc( GetProcessHeap(), 0, sizeof(int) + len ); params = malloc( sizeof(int) + len );
ret_addr = HeapAlloc( GetProcessHeap(), 0, len ); ret_addr = malloc( len );
if (!params || !ret_addr) if (!params || !ret_addr)
{ {
HeapFree( GetProcessHeap(), 0, params ); free( params );
HeapFree( GetProcessHeap(), 0, ret_addr ); free( ret_addr );
SetLastError( WSAENOBUFS ); SetLastError( WSAENOBUFS );
return -1; return -1;
} }
...@@ -1129,8 +1129,8 @@ int WINAPI bind( SOCKET s, const struct sockaddr *addr, int len ) ...@@ -1129,8 +1129,8 @@ int WINAPI bind( SOCKET s, const struct sockaddr *addr, int len )
status = io.u.Status; status = io.u.Status;
} }
HeapFree( GetProcessHeap(), 0, params ); free( params );
HeapFree( GetProcessHeap(), 0, ret_addr ); free( ret_addr );
SetLastError( NtStatusToWSAError( status ) ); SetLastError( NtStatusToWSAError( status ) );
return status ? -1 : 0; return status ? -1 : 0;
...@@ -1175,7 +1175,7 @@ int WINAPI connect( SOCKET s, const struct sockaddr *addr, int len ) ...@@ -1175,7 +1175,7 @@ int WINAPI connect( SOCKET s, const struct sockaddr *addr, int len )
if (!(sync_event = get_sync_event())) return -1; if (!(sync_event = get_sync_event())) return -1;
if (!(params = HeapAlloc( GetProcessHeap(), 0, sizeof(*params) + len ))) if (!(params = malloc( sizeof(*params) + len )))
{ {
SetLastError( ERROR_NOT_ENOUGH_MEMORY ); SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return -1; return -1;
...@@ -1186,7 +1186,7 @@ int WINAPI connect( SOCKET s, const struct sockaddr *addr, int len ) ...@@ -1186,7 +1186,7 @@ int WINAPI connect( SOCKET s, const struct sockaddr *addr, int len )
status = NtDeviceIoControlFile( (HANDLE)s, sync_event, NULL, NULL, &io, IOCTL_AFD_WINE_CONNECT, status = NtDeviceIoControlFile( (HANDLE)s, sync_event, NULL, NULL, &io, IOCTL_AFD_WINE_CONNECT,
params, sizeof(*params) + len, NULL, 0 ); params, sizeof(*params) + len, NULL, 0 );
HeapFree( GetProcessHeap(), 0, params ); free( params );
if (status == STATUS_PENDING) if (status == STATUS_PENDING)
{ {
if (WaitForSingleObject( sync_event, INFINITE ) == WAIT_FAILED) return -1; if (WaitForSingleObject( sync_event, INFINITE ) == WAIT_FAILED) return -1;
...@@ -1235,7 +1235,7 @@ static BOOL WINAPI WS2_ConnectEx( SOCKET s, const struct sockaddr *name, int nam ...@@ -1235,7 +1235,7 @@ static BOOL WINAPI WS2_ConnectEx( SOCKET s, const struct sockaddr *name, int nam
overlapped->Internal = STATUS_PENDING; overlapped->Internal = STATUS_PENDING;
overlapped->InternalHigh = 0; overlapped->InternalHigh = 0;
if (!(params = HeapAlloc( GetProcessHeap(), 0, sizeof(*params) + namelen + send_len ))) if (!(params = malloc( sizeof(*params) + namelen + send_len )))
{ {
SetLastError( ERROR_NOT_ENOUGH_MEMORY ); SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return SOCKET_ERROR; return SOCKET_ERROR;
...@@ -1248,7 +1248,7 @@ static BOOL WINAPI WS2_ConnectEx( SOCKET s, const struct sockaddr *name, int nam ...@@ -1248,7 +1248,7 @@ static BOOL WINAPI WS2_ConnectEx( SOCKET s, const struct sockaddr *name, int nam
status = NtDeviceIoControlFile( SOCKET2HANDLE(s), overlapped->hEvent, NULL, cvalue, status = NtDeviceIoControlFile( SOCKET2HANDLE(s), overlapped->hEvent, NULL, cvalue,
(IO_STATUS_BLOCK *)overlapped, IOCTL_AFD_WINE_CONNECT, (IO_STATUS_BLOCK *)overlapped, IOCTL_AFD_WINE_CONNECT,
params, sizeof(*params) + namelen + send_len, NULL, 0 ); params, sizeof(*params) + namelen + send_len, NULL, 0 );
HeapFree( GetProcessHeap(), 0, params ); free( params );
if (ret_len) *ret_len = overlapped->InternalHigh; if (ret_len) *ret_len = overlapped->InternalHigh;
SetLastError( NtStatusToWSAError( status ) ); SetLastError( NtStatusToWSAError( status ) );
return !status; return !status;
...@@ -2028,7 +2028,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID ...@@ -2028,7 +2028,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
if (GetAdaptersInfo(NULL, &size) == ERROR_BUFFER_OVERFLOW) if (GetAdaptersInfo(NULL, &size) == ERROR_BUFFER_OVERFLOW)
{ {
IP_ADAPTER_INFO *p, *table = HeapAlloc(GetProcessHeap(), 0, size); IP_ADAPTER_INFO *p, *table = malloc( size );
NTSTATUS status = STATUS_SUCCESS; NTSTATUS status = STATUS_SUCCESS;
SOCKET_ADDRESS_LIST *sa_list; SOCKET_ADDRESS_LIST *sa_list;
SOCKADDR_IN *sockaddr; SOCKADDR_IN *sockaddr;
...@@ -2039,7 +2039,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID ...@@ -2039,7 +2039,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
if (!table || GetAdaptersInfo(table, &size)) if (!table || GetAdaptersInfo(table, &size))
{ {
HeapFree(GetProcessHeap(), 0, table); free( table );
SetLastError( WSAEINVAL ); SetLastError( WSAEINVAL );
return -1; return -1;
} }
...@@ -2051,7 +2051,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID ...@@ -2051,7 +2051,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
if (total > out_size || !out_buff) if (total > out_size || !out_buff)
{ {
*ret_size = total; *ret_size = total;
HeapFree(GetProcessHeap(), 0, table); free( table );
SetLastError( WSAEFAULT ); SetLastError( WSAEFAULT );
return -1; return -1;
} }
...@@ -2074,7 +2074,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID ...@@ -2074,7 +2074,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
i++; i++;
} }
HeapFree(GetProcessHeap(), 0, table); free( table );
ret = server_ioctl_sock( s, IOCTL_AFD_WINE_COMPLETE_ASYNC, &status, sizeof(status), ret = server_ioctl_sock( s, IOCTL_AFD_WINE_COMPLETE_ASYNC, &status, sizeof(status),
NULL, 0, ret_size, overlapped, completion ); NULL, 0, ret_size, overlapped, completion );
...@@ -2173,10 +2173,10 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID ...@@ -2173,10 +2173,10 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
SetLastError( WSAEFAULT ); SetLastError( WSAEFAULT );
return -1; return -1;
} }
ipAddrTable = HeapAlloc( GetProcessHeap(), 0, size ); ipAddrTable = malloc( size );
if (GetIpAddrTable( ipAddrTable, &size, FALSE )) if (GetIpAddrTable( ipAddrTable, &size, FALSE ))
{ {
HeapFree( GetProcessHeap(), 0, ipAddrTable ); free( ipAddrTable );
SetLastError( WSAEFAULT ); SetLastError( WSAEFAULT );
return -1; return -1;
} }
...@@ -2190,14 +2190,14 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID ...@@ -2190,14 +2190,14 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
{ {
ERR("no matching IP address for interface %d\n", ERR("no matching IP address for interface %d\n",
row.dwForwardIfIndex); row.dwForwardIfIndex);
HeapFree( GetProcessHeap(), 0, ipAddrTable ); free( ipAddrTable );
SetLastError( WSAEFAULT ); SetLastError( WSAEFAULT );
return -1; return -1;
} }
saddr_in->sin_family = AF_INET; saddr_in->sin_family = AF_INET;
saddr_in->sin_addr.S_un.S_addr = ipAddrTable->table[found_index].dwAddr; saddr_in->sin_addr.S_un.S_addr = ipAddrTable->table[found_index].dwAddr;
saddr_in->sin_port = 0; saddr_in->sin_port = 0;
HeapFree( GetProcessHeap(), 0, ipAddrTable ); free( ipAddrTable );
ret = server_ioctl_sock( s, IOCTL_AFD_WINE_COMPLETE_ASYNC, &status, sizeof(status), ret = server_ioctl_sock( s, IOCTL_AFD_WINE_COMPLETE_ASYNC, &status, sizeof(status),
NULL, 0, ret_size, overlapped, completion ); NULL, 0, ret_size, overlapped, completion );
...@@ -2530,7 +2530,7 @@ int WINAPI WSAPoll( WSAPOLLFD *fds, ULONG count, int timeout ) ...@@ -2530,7 +2530,7 @@ int WINAPI WSAPoll( WSAPOLLFD *fds, ULONG count, int timeout )
if (!(sync_event = get_sync_event())) return -1; if (!(sync_event = get_sync_event())) return -1;
params_size = offsetof( struct afd_poll_params, sockets[count] ); params_size = offsetof( struct afd_poll_params, sockets[count] );
if (!(params = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, params_size ))) if (!(params = calloc( params_size, 1 )))
{ {
SetLastError(WSAENOBUFS); SetLastError(WSAENOBUFS);
return SOCKET_ERROR; return SOCKET_ERROR;
...@@ -2566,7 +2566,7 @@ int WINAPI WSAPoll( WSAPOLLFD *fds, ULONG count, int timeout ) ...@@ -2566,7 +2566,7 @@ int WINAPI WSAPoll( WSAPOLLFD *fds, ULONG count, int timeout )
if (!poll_socket) if (!poll_socket)
{ {
SetLastError( WSAENOTSOCK ); SetLastError( WSAENOTSOCK );
HeapFree( GetProcessHeap(), 0, params ); free( params );
return -1; return -1;
} }
...@@ -2576,7 +2576,7 @@ int WINAPI WSAPoll( WSAPOLLFD *fds, ULONG count, int timeout ) ...@@ -2576,7 +2576,7 @@ int WINAPI WSAPoll( WSAPOLLFD *fds, ULONG count, int timeout )
{ {
if (WaitForSingleObject( sync_event, INFINITE ) == WAIT_FAILED) if (WaitForSingleObject( sync_event, INFINITE ) == WAIT_FAILED)
{ {
HeapFree( GetProcessHeap(), 0, params ); free( params );
return -1; return -1;
} }
status = io.u.Status; status = io.u.Status;
...@@ -2614,7 +2614,7 @@ int WINAPI WSAPoll( WSAPOLLFD *fds, ULONG count, int timeout ) ...@@ -2614,7 +2614,7 @@ int WINAPI WSAPoll( WSAPOLLFD *fds, ULONG count, int timeout )
} }
if (status == STATUS_TIMEOUT) status = STATUS_SUCCESS; if (status == STATUS_TIMEOUT) status = STATUS_SUCCESS;
HeapFree( GetProcessHeap(), 0, params ); free( params );
SetLastError( NtStatusToWSAError( status ) ); SetLastError( NtStatusToWSAError( status ) );
return status ? -1 : ret_count; return status ? -1 : ret_count;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
...@@ -50,7 +51,6 @@ ...@@ -50,7 +51,6 @@
#include "wine/afd.h" #include "wine/afd.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/heap.h"
#include "wine/unixlib.h" #include "wine/unixlib.h"
#define DECLARE_CRITICAL_SECTION(cs) \ #define DECLARE_CRITICAL_SECTION(cs) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment