Commit f081205b authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

http: Use CRT allocation functions.

parent b47a3305
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "winternl.h" #include "winternl.h"
#include "ddk/wdm.h" #include "ddk/wdm.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h" #include "wine/list.h"
static HANDLE directory_obj; static HANDLE directory_obj;
...@@ -118,17 +117,17 @@ static void accept_connection(SOCKET socket) ...@@ -118,17 +117,17 @@ static void accept_connection(SOCKET socket)
if ((peer = accept(socket, NULL, NULL)) == INVALID_SOCKET) if ((peer = accept(socket, NULL, NULL)) == INVALID_SOCKET)
return; return;
if (!(conn = heap_alloc_zero(sizeof(*conn)))) if (!(conn = calloc(1, sizeof(*conn))))
{ {
ERR("Failed to allocate memory.\n"); ERR("Failed to allocate memory.\n");
shutdown(peer, SD_BOTH); shutdown(peer, SD_BOTH);
closesocket(peer); closesocket(peer);
return; return;
} }
if (!(conn->buffer = heap_alloc(8192))) if (!(conn->buffer = malloc(8192)))
{ {
ERR("Failed to allocate buffer memory.\n"); ERR("Failed to allocate buffer memory.\n");
heap_free(conn); free(conn);
shutdown(peer, SD_BOTH); shutdown(peer, SD_BOTH);
closesocket(peer); closesocket(peer);
return; return;
...@@ -142,11 +141,11 @@ static void accept_connection(SOCKET socket) ...@@ -142,11 +141,11 @@ static void accept_connection(SOCKET socket)
static void close_connection(struct connection *conn) static void close_connection(struct connection *conn)
{ {
heap_free(conn->buffer); free(conn->buffer);
shutdown(conn->socket, SD_BOTH); shutdown(conn->socket, SD_BOTH);
closesocket(conn->socket); closesocket(conn->socket);
list_remove(&conn->entry); list_remove(&conn->entry);
heap_free(conn); free(conn);
} }
static HTTP_VERB parse_verb(const char *verb, int len) static HTTP_VERB parse_verb(const char *verb, int len)
...@@ -629,7 +628,7 @@ static void receive_data(struct connection *conn) ...@@ -629,7 +628,7 @@ static void receive_data(struct connection *conn)
if (available) if (available)
{ {
TRACE("%lu more bytes of data available, trying with larger buffer.\n", available); TRACE("%lu more bytes of data available, trying with larger buffer.\n", available);
if (!(conn->buffer = heap_realloc(conn->buffer, conn->len + available))) if (!(conn->buffer = realloc(conn->buffer, conn->len + available)))
{ {
ERR("Failed to allocate %lu bytes of memory.\n", conn->len + available); ERR("Failed to allocate %lu bytes of memory.\n", conn->len + available);
close_connection(conn); close_connection(conn);
......
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