Commit e5df70ce authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

ws2_32/tests: Use CRT allocation functions.

parent e08435a8
...@@ -96,7 +96,7 @@ static void test_WSAEnumProtocolsA(void) ...@@ -96,7 +96,7 @@ static void test_WSAEnumProtocolsA(void)
error = WSAGetLastError(); error = WSAGetLastError();
ok( error == WSAENOBUFS, "Expected 10055, received %ld\n", error); ok( error == WSAENOBUFS, "Expected 10055, received %ld\n", error);
buffer = HeapAlloc( GetProcessHeap(), 0, len ); buffer = malloc( len );
if (buffer) if (buffer)
{ {
...@@ -113,7 +113,7 @@ static void test_WSAEnumProtocolsA(void) ...@@ -113,7 +113,7 @@ static void test_WSAEnumProtocolsA(void)
buffer[i].dwServiceFlags1); buffer[i].dwServiceFlags1);
} }
HeapFree( GetProcessHeap(), 0, buffer ); free( buffer );
} }
/* Test invalid protocols in the list */ /* Test invalid protocols in the list */
...@@ -123,7 +123,7 @@ static void test_WSAEnumProtocolsA(void) ...@@ -123,7 +123,7 @@ static void test_WSAEnumProtocolsA(void)
ok( error == WSAENOBUFS || broken(error == WSAEFAULT) /* NT4 */, ok( error == WSAENOBUFS || broken(error == WSAEFAULT) /* NT4 */,
"Expected 10055, received %ld\n", error); "Expected 10055, received %ld\n", error);
buffer = HeapAlloc( GetProcessHeap(), 0, len ); buffer = malloc( len );
if (buffer) if (buffer)
{ {
...@@ -141,7 +141,7 @@ static void test_WSAEnumProtocolsA(void) ...@@ -141,7 +141,7 @@ static void test_WSAEnumProtocolsA(void)
} }
ok(found == 0x0A, "Expected 2 bits represented as 0xA, received 0x%x\n", found); ok(found == 0x0A, "Expected 2 bits represented as 0xA, received 0x%x\n", found);
HeapFree( GetProcessHeap(), 0, buffer ); free( buffer );
} }
} }
...@@ -164,7 +164,7 @@ static void test_WSAEnumProtocolsW(void) ...@@ -164,7 +164,7 @@ static void test_WSAEnumProtocolsW(void)
error = WSAGetLastError(); error = WSAGetLastError();
ok( error == WSAENOBUFS, "Expected 10055, received %ld\n", error); ok( error == WSAENOBUFS, "Expected 10055, received %ld\n", error);
buffer = HeapAlloc( GetProcessHeap(), 0, len ); buffer = malloc( len );
if (buffer) if (buffer)
{ {
...@@ -181,7 +181,7 @@ static void test_WSAEnumProtocolsW(void) ...@@ -181,7 +181,7 @@ static void test_WSAEnumProtocolsW(void)
buffer[i].dwServiceFlags1); buffer[i].dwServiceFlags1);
} }
HeapFree( GetProcessHeap(), 0, buffer ); free( buffer );
} }
/* Test invalid protocols in the list */ /* Test invalid protocols in the list */
...@@ -191,7 +191,7 @@ static void test_WSAEnumProtocolsW(void) ...@@ -191,7 +191,7 @@ static void test_WSAEnumProtocolsW(void)
ok( error == WSAENOBUFS || broken(error == WSAEFAULT) /* NT4 */, ok( error == WSAENOBUFS || broken(error == WSAEFAULT) /* NT4 */,
"Expected 10055, received %ld\n", error); "Expected 10055, received %ld\n", error);
buffer = HeapAlloc( GetProcessHeap(), 0, len ); buffer = malloc( len );
if (buffer) if (buffer)
{ {
...@@ -209,7 +209,7 @@ static void test_WSAEnumProtocolsW(void) ...@@ -209,7 +209,7 @@ static void test_WSAEnumProtocolsW(void)
} }
ok(found == 0x0A, "Expected 2 bits represented as 0xA, received 0x%x\n", found); ok(found == 0x0A, "Expected 2 bits represented as 0xA, received 0x%x\n", found);
HeapFree( GetProcessHeap(), 0, buffer ); free( buffer );
} }
} }
...@@ -2595,8 +2595,8 @@ static void test_gethostbyname(void) ...@@ -2595,8 +2595,8 @@ static void test_gethostbyname(void)
ret = GetIpForwardTable(NULL, &route_size, FALSE); ret = GetIpForwardTable(NULL, &route_size, FALSE);
ok(ret == ERROR_INSUFFICIENT_BUFFER, "GetIpForwardTable failed with a different error: %d\n", ret); ok(ret == ERROR_INSUFFICIENT_BUFFER, "GetIpForwardTable failed with a different error: %d\n", ret);
adapters = HeapAlloc(GetProcessHeap(), 0, adap_size); adapters = malloc(adap_size);
routes = HeapAlloc(GetProcessHeap(), 0, route_size); routes = malloc(route_size);
ret = GetAdaptersInfo(adapters, &adap_size); ret = GetAdaptersInfo(adapters, &adap_size);
ok(ret == NO_ERROR, "GetAdaptersInfo failed, error: %d\n", ret); ok(ret == NO_ERROR, "GetAdaptersInfo failed, error: %d\n", ret);
...@@ -2633,8 +2633,8 @@ static void test_gethostbyname(void) ...@@ -2633,8 +2633,8 @@ static void test_gethostbyname(void)
ok(found_default, "failed to find the first IP from gethostbyname!\n"); ok(found_default, "failed to find the first IP from gethostbyname!\n");
cleanup: cleanup:
HeapFree(GetProcessHeap(), 0, adapters); free(adapters);
HeapFree(GetProcessHeap(), 0, routes); free(routes);
} }
static void test_gethostbyname_hack(void) static void test_gethostbyname_hack(void)
...@@ -2792,13 +2792,13 @@ static void test_WSAEnumNameSpaceProvidersA(void) ...@@ -2792,13 +2792,13 @@ static void test_WSAEnumNameSpaceProvidersA(void)
todo_wine todo_wine
ok(error == WSAEFAULT, "Expected 10014, got %lu\n", error); ok(error == WSAEFAULT, "Expected 10014, got %lu\n", error);
name = HeapAlloc(GetProcessHeap(), 0, len); name = malloc(len);
ret = WSAEnumNameSpaceProvidersA(&len, name); ret = WSAEnumNameSpaceProvidersA(&len, name);
todo_wine todo_wine
ok(ret > 0, "Expected more than zero name space providers\n"); ok(ret > 0, "Expected more than zero name space providers\n");
HeapFree(GetProcessHeap(), 0, name); free(name);
} }
static void test_WSAEnumNameSpaceProvidersW(void) static void test_WSAEnumNameSpaceProvidersW(void)
...@@ -2839,7 +2839,7 @@ static void test_WSAEnumNameSpaceProvidersW(void) ...@@ -2839,7 +2839,7 @@ static void test_WSAEnumNameSpaceProvidersW(void)
todo_wine todo_wine
ok(error == WSAEFAULT, "Expected 10014, got %lu\n", error); ok(error == WSAEFAULT, "Expected 10014, got %lu\n", error);
name = HeapAlloc(GetProcessHeap(), 0, len); name = malloc(len);
ret = WSAEnumNameSpaceProvidersW(&len, name); ret = WSAEnumNameSpaceProvidersW(&len, name);
todo_wine todo_wine
...@@ -2868,7 +2868,7 @@ static void test_WSAEnumNameSpaceProvidersW(void) ...@@ -2868,7 +2868,7 @@ static void test_WSAEnumNameSpaceProvidersW(void)
} }
} }
HeapFree(GetProcessHeap(), 0, name); free(name);
} }
static void test_WSCGetProviderInfo(void) static void test_WSCGetProviderInfo(void)
......
...@@ -3114,7 +3114,7 @@ static void test_WSASocket(void) ...@@ -3114,7 +3114,7 @@ static void test_WSASocket(void)
ok(err == WSAENOBUFS, "WSAEnumProtocolsA error is %d, not WSAENOBUFS(%d)\n", ok(err == WSAENOBUFS, "WSAEnumProtocolsA error is %d, not WSAENOBUFS(%d)\n",
err, WSAENOBUFS); err, WSAENOBUFS);
pi = HeapAlloc(GetProcessHeap(), 0, pi_size); pi = malloc(pi_size);
ok(pi != NULL, "Failed to allocate memory\n"); ok(pi != NULL, "Failed to allocate memory\n");
items = WSAEnumProtocolsA(wsaproviders, pi, &pi_size); items = WSAEnumProtocolsA(wsaproviders, pi, &pi_size);
...@@ -3123,7 +3123,7 @@ static void test_WSASocket(void) ...@@ -3123,7 +3123,7 @@ static void test_WSASocket(void)
if (items == 0) { if (items == 0) {
skip("No protocols enumerated.\n"); skip("No protocols enumerated.\n");
HeapFree(GetProcessHeap(), 0, pi); free(pi);
return; return;
} }
...@@ -3210,7 +3210,7 @@ static void test_WSASocket(void) ...@@ -3210,7 +3210,7 @@ static void test_WSASocket(void)
closesocket(sock); closesocket(sock);
HeapFree(GetProcessHeap(), 0, pi); free(pi);
pi_size = 0; pi_size = 0;
items = WSAEnumProtocolsA(NULL, NULL, &pi_size); items = WSAEnumProtocolsA(NULL, NULL, &pi_size);
...@@ -3220,7 +3220,7 @@ static void test_WSASocket(void) ...@@ -3220,7 +3220,7 @@ static void test_WSASocket(void)
ok(err == WSAENOBUFS, "WSAEnumProtocolsA error is %d, not WSAENOBUFS(%d)\n", ok(err == WSAENOBUFS, "WSAEnumProtocolsA error is %d, not WSAENOBUFS(%d)\n",
err, WSAENOBUFS); err, WSAENOBUFS);
pi = HeapAlloc(GetProcessHeap(), 0, pi_size); pi = malloc(pi_size);
ok(pi != NULL, "Failed to allocate memory\n"); ok(pi != NULL, "Failed to allocate memory\n");
items = WSAEnumProtocolsA(NULL, pi, &pi_size); items = WSAEnumProtocolsA(NULL, pi, &pi_size);
...@@ -3277,7 +3277,7 @@ static void test_WSASocket(void) ...@@ -3277,7 +3277,7 @@ static void test_WSASocket(void)
closesocket(sock); closesocket(sock);
} }
HeapFree(GetProcessHeap(), 0, pi); free(pi);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
/* starting on vista the socket function returns error during the socket /* starting on vista the socket function returns error during the socket
...@@ -5944,7 +5944,7 @@ static void test_send(void) ...@@ -5944,7 +5944,7 @@ static void test_send(void)
hThread = CreateThread(NULL, 0, drain_socket_thread, &dst, 0, &id); hThread = CreateThread(NULL, 0, drain_socket_thread, &dst, 0, &id);
buffer = HeapAlloc(GetProcessHeap(), 0, buflen); buffer = malloc(buflen);
/* fill the buffer with some nonsense */ /* fill the buffer with some nonsense */
for (i = 0; i < buflen; ++i) for (i = 0; i < buflen; ++i)
...@@ -6022,7 +6022,7 @@ end: ...@@ -6022,7 +6022,7 @@ end:
} }
if (ov.hEvent) if (ov.hEvent)
CloseHandle(ov.hEvent); CloseHandle(ov.hEvent);
HeapFree(GetProcessHeap(), 0, buffer); free(buffer);
} }
#define WM_SOCKET (WM_USER+100) #define WM_SOCKET (WM_USER+100)
......
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