Commit 22c293bd authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wsdapi: Use CRT allocation functions.

parent 1e8393f9
...@@ -91,7 +91,7 @@ static ULONG WINAPI IWSDUdpAddressImpl_Release(IWSDUdpAddress *iface) ...@@ -91,7 +91,7 @@ static ULONG WINAPI IWSDUdpAddressImpl_Release(IWSDUdpAddress *iface)
if (ref == 0) if (ref == 0)
{ {
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -354,7 +354,7 @@ HRESULT WINAPI WSDCreateUdpAddress(IWSDUdpAddress **ppAddress) ...@@ -354,7 +354,7 @@ HRESULT WINAPI WSDCreateUdpAddress(IWSDUdpAddress **ppAddress)
*ppAddress = NULL; *ppAddress = NULL;
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj)); obj = calloc(1, sizeof(*obj));
if (!obj) if (!obj)
{ {
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "wsdapi_internal.h" #include "wsdapi_internal.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "guiddef.h" #include "guiddef.h"
WINE_DEFAULT_DEBUG_CHANNEL(wsdapi); WINE_DEFAULT_DEBUG_CHANNEL(wsdapi);
...@@ -95,20 +94,20 @@ static ULONG WINAPI IWSDiscoveryPublisherImpl_Release(IWSDiscoveryPublisher *ifa ...@@ -95,20 +94,20 @@ static ULONG WINAPI IWSDiscoveryPublisherImpl_Release(IWSDiscoveryPublisher *ifa
{ {
IWSDiscoveryPublisherNotify_Release(sink->notificationSink); IWSDiscoveryPublisherNotify_Release(sink->notificationSink);
list_remove(&sink->entry); list_remove(&sink->entry);
HeapFree(GetProcessHeap(), 0, sink); free(sink);
} }
DeleteCriticalSection(&This->notification_sink_critical_section); DeleteCriticalSection(&This->notification_sink_critical_section);
LIST_FOR_EACH_ENTRY_SAFE(msg_id, msg_id_cursor, &This->message_ids, struct message_id, entry) LIST_FOR_EACH_ENTRY_SAFE(msg_id, msg_id_cursor, &This->message_ids, struct message_id, entry)
{ {
heap_free(msg_id->id); free(msg_id->id);
list_remove(&msg_id->entry); list_remove(&msg_id->entry);
heap_free(msg_id); free(msg_id);
} }
DeleteCriticalSection(&This->message_ids_critical_section); DeleteCriticalSection(&This->message_ids_critical_section);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -149,7 +148,7 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_RegisterNotificationSink(IWSDisc ...@@ -149,7 +148,7 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_RegisterNotificationSink(IWSDisc
return E_INVALIDARG; return E_INVALIDARG;
} }
sink = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*sink)); sink = calloc(1, sizeof(*sink));
if (!sink) if (!sink)
{ {
...@@ -189,7 +188,7 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_UnRegisterNotificationSink(IWSDi ...@@ -189,7 +188,7 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_UnRegisterNotificationSink(IWSDi
{ {
IWSDiscoveryPublisherNotify_Release(pSink); IWSDiscoveryPublisherNotify_Release(pSink);
list_remove(&sink->entry); list_remove(&sink->entry);
HeapFree(GetProcessHeap(), 0, sink); free(sink);
LeaveCriticalSection(&impl->notification_sink_critical_section); LeaveCriticalSection(&impl->notification_sink_critical_section);
return S_OK; return S_OK;
...@@ -421,7 +420,7 @@ HRESULT WINAPI WSDCreateDiscoveryPublisher(IWSDXMLContext *pContext, IWSDiscover ...@@ -421,7 +420,7 @@ HRESULT WINAPI WSDCreateDiscoveryPublisher(IWSDXMLContext *pContext, IWSDiscover
*ppPublisher = NULL; *ppPublisher = NULL;
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj)); obj = calloc(1, sizeof(*obj));
if (!obj) if (!obj)
{ {
...@@ -439,7 +438,7 @@ HRESULT WINAPI WSDCreateDiscoveryPublisher(IWSDXMLContext *pContext, IWSDiscover ...@@ -439,7 +438,7 @@ HRESULT WINAPI WSDCreateDiscoveryPublisher(IWSDXMLContext *pContext, IWSDiscover
if (FAILED(ret)) if (FAILED(ret))
{ {
WARN("Unable to create XML context\n"); WARN("Unable to create XML context\n");
heap_free(obj); free(obj);
return ret; return ret;
} }
} }
...@@ -454,7 +453,7 @@ HRESULT WINAPI WSDCreateDiscoveryPublisher(IWSDXMLContext *pContext, IWSDiscover ...@@ -454,7 +453,7 @@ HRESULT WINAPI WSDCreateDiscoveryPublisher(IWSDXMLContext *pContext, IWSDiscover
if (FAILED(ret)) if (FAILED(ret))
{ {
WARN("Unable to register default namespaces\n"); WARN("Unable to register default namespaces\n");
heap_free(obj); free(obj);
return ret; return ret;
} }
......
...@@ -74,7 +74,7 @@ static void free_allocation(struct memory_allocation *item) ...@@ -74,7 +74,7 @@ static void free_allocation(struct memory_allocation *item)
list_remove(&item->entry); list_remove(&item->entry);
item->magic = 0; item->magic = 0;
HeapFree(GetProcessHeap(), 0, item); free(item);
} }
void * WINAPI WSDAllocateLinkedMemory(void *pParent, SIZE_T cbSize) void * WINAPI WSDAllocateLinkedMemory(void *pParent, SIZE_T cbSize)
...@@ -84,7 +84,7 @@ void * WINAPI WSDAllocateLinkedMemory(void *pParent, SIZE_T cbSize) ...@@ -84,7 +84,7 @@ void * WINAPI WSDAllocateLinkedMemory(void *pParent, SIZE_T cbSize)
TRACE("(%p, %Iu)\n", pParent, cbSize); TRACE("(%p, %Iu)\n", pParent, cbSize);
ptr = HeapAlloc(GetProcessHeap(), 0, MEMORY_ALLOCATION_SIZE + cbSize); ptr = malloc(MEMORY_ALLOCATION_SIZE + cbSize);
if (ptr == NULL) if (ptr == NULL)
{ {
......
...@@ -81,7 +81,7 @@ static ULONG IWSDMessageParametersImpl_Release(IWSDMessageParameters *iface) ...@@ -81,7 +81,7 @@ static ULONG IWSDMessageParametersImpl_Release(IWSDMessageParameters *iface)
IWSDAddress_Release(This->remoteAddress); IWSDAddress_Release(This->remoteAddress);
} }
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -310,7 +310,7 @@ HRESULT WINAPI WSDCreateUdpMessageParameters(IWSDUdpMessageParameters **ppTxPara ...@@ -310,7 +310,7 @@ HRESULT WINAPI WSDCreateUdpMessageParameters(IWSDUdpMessageParameters **ppTxPara
*ppTxParams = NULL; *ppTxParams = NULL;
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj)); obj = calloc(1, sizeof(*obj));
if (!obj) return E_OUTOFMEMORY; if (!obj) return E_OUTOFMEMORY;
obj->base.IWSDMessageParameters_iface.lpVtbl = (IWSDMessageParametersVtbl *)&udpMsgParamsVtbl; obj->base.IWSDMessageParameters_iface.lpVtbl = (IWSDMessageParametersVtbl *)&udpMsgParamsVtbl;
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "wsdapi_internal.h" #include "wsdapi_internal.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "iphlpapi.h" #include "iphlpapi.h"
#include "bcrypt.h" #include "bcrypt.h"
...@@ -92,8 +91,8 @@ static DWORD WINAPI sending_thread(LPVOID lpParam) ...@@ -92,8 +91,8 @@ static DWORD WINAPI sending_thread(LPVOID lpParam)
MULTICAST_UDP_REPEAT); MULTICAST_UDP_REPEAT);
closesocket(params->sock); closesocket(params->sock);
heap_free(params->data); free(params->data);
heap_free(params); free(params);
return 0; return 0;
} }
...@@ -120,7 +119,7 @@ static BOOL send_udp_multicast_of_type(char *data, int length, int max_initial_d ...@@ -120,7 +119,7 @@ static BOOL send_udp_multicast_of_type(char *data, int length, int max_initial_d
goto cleanup; goto cleanup;
} }
adapter_addresses = (IP_ADAPTER_ADDRESSES *) heap_alloc(bufferSize); adapter_addresses = malloc(bufferSize);
if (adapter_addresses == NULL) if (adapter_addresses == NULL)
{ {
...@@ -170,9 +169,9 @@ static BOOL send_udp_multicast_of_type(char *data, int length, int max_initial_d ...@@ -170,9 +169,9 @@ static BOOL send_udp_multicast_of_type(char *data, int length, int max_initial_d
setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)); setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl));
/* Set up the thread parameters */ /* Set up the thread parameters */
send_params = heap_alloc(sizeof(*send_params)); send_params = malloc(sizeof(*send_params));
send_params->data = heap_alloc(length); send_params->data = malloc(length);
memcpy(send_params->data, data, length); memcpy(send_params->data, data, length);
send_params->length = length; send_params->length = length;
send_params->sock = s; send_params->sock = s;
...@@ -203,8 +202,8 @@ static BOOL send_udp_multicast_of_type(char *data, int length, int max_initial_d ...@@ -203,8 +202,8 @@ static BOOL send_udp_multicast_of_type(char *data, int length, int max_initial_d
WARN("CreateThread failed (error %ld)\n", GetLastError()); WARN("CreateThread failed (error %ld)\n", GetLastError());
closesocket(s); closesocket(s);
heap_free(send_params->data); free(send_params->data);
heap_free(send_params); free(send_params);
continue; continue;
} }
...@@ -215,7 +214,7 @@ static BOOL send_udp_multicast_of_type(char *data, int length, int max_initial_d ...@@ -215,7 +214,7 @@ static BOOL send_udp_multicast_of_type(char *data, int length, int max_initial_d
ret = TRUE; ret = TRUE;
cleanup: cleanup:
heap_free(adapter_addresses); free(adapter_addresses);
return ret; return ret;
} }
...@@ -359,7 +358,7 @@ static DWORD WINAPI listening_thread(LPVOID params) ...@@ -359,7 +358,7 @@ static DWORD WINAPI listening_thread(LPVOID params)
SOCKADDR_STORAGE source_addr; SOCKADDR_STORAGE source_addr;
char *buffer; char *buffer;
buffer = heap_alloc(RECEIVE_BUFFER_SIZE); buffer = malloc(RECEIVE_BUFFER_SIZE);
address_len = parameter->ipv6 ? sizeof(SOCKADDR_IN6) : sizeof(SOCKADDR_IN); address_len = parameter->ipv6 ? sizeof(SOCKADDR_IN6) : sizeof(SOCKADDR_IN);
while (parameter->impl->publisherStarted) while (parameter->impl->publisherStarted)
...@@ -386,8 +385,8 @@ static DWORD WINAPI listening_thread(LPVOID params) ...@@ -386,8 +385,8 @@ static DWORD WINAPI listening_thread(LPVOID params)
/* The publisher has been stopped */ /* The publisher has been stopped */
closesocket(parameter->listening_socket); closesocket(parameter->listening_socket);
heap_free(buffer); free(buffer);
heap_free(parameter); free(parameter);
return 0; return 0;
} }
...@@ -477,7 +476,7 @@ static int start_listening(IWSDiscoveryPublisherImpl *impl, SOCKADDR_STORAGE *bi ...@@ -477,7 +476,7 @@ static int start_listening(IWSDiscoveryPublisherImpl *impl, SOCKADDR_STORAGE *bi
} }
/* Allocate memory for thread parameters */ /* Allocate memory for thread parameters */
parameter = heap_alloc(sizeof(listener_thread_params)); parameter = malloc(sizeof(*parameter));
parameter->impl = impl; parameter->impl = impl;
parameter->listening_socket = s; parameter->listening_socket = s;
...@@ -498,7 +497,7 @@ static int start_listening(IWSDiscoveryPublisherImpl *impl, SOCKADDR_STORAGE *bi ...@@ -498,7 +497,7 @@ static int start_listening(IWSDiscoveryPublisherImpl *impl, SOCKADDR_STORAGE *bi
cleanup: cleanup:
closesocket(s); closesocket(s);
heap_free(parameter); free(parameter);
return 0; return 0;
} }
...@@ -519,7 +518,7 @@ static BOOL start_listening_on_all_addresses(IWSDiscoveryPublisherImpl *impl, UL ...@@ -519,7 +518,7 @@ static BOOL start_listening_on_all_addresses(IWSDiscoveryPublisherImpl *impl, UL
} }
/* Get size of buffer for adapters */ /* Get size of buffer for adapters */
adapter_addresses = (IP_ADAPTER_ADDRESSES *)heap_alloc(bufferSize); adapter_addresses = malloc(bufferSize);
if (adapter_addresses == NULL) if (adapter_addresses == NULL)
{ {
...@@ -554,7 +553,7 @@ static BOOL start_listening_on_all_addresses(IWSDiscoveryPublisherImpl *impl, UL ...@@ -554,7 +553,7 @@ static BOOL start_listening_on_all_addresses(IWSDiscoveryPublisherImpl *impl, UL
} }
cleanup: cleanup:
heap_free(adapter_addresses); free(adapter_addresses);
return (ret == ERROR_SUCCESS) && (valid_listeners > 0); return (ret == ERROR_SUCCESS) && (valid_listeners > 0);
} }
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "wsdapi_internal.h" #include "wsdapi_internal.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "webservices.h" #include "webservices.h"
WINE_DEFAULT_DEBUG_CHANNEL(wsdapi); WINE_DEFAULT_DEBUG_CHANNEL(wsdapi);
...@@ -106,7 +105,7 @@ static char *wide_to_utf8(LPCWSTR wide_string, int *length) ...@@ -106,7 +105,7 @@ static char *wide_to_utf8(LPCWSTR wide_string, int *length)
if (*length < 0) if (*length < 0)
return NULL; return NULL;
new_string = heap_alloc(*length); new_string = malloc(*length);
WideCharToMultiByte(CP_UTF8, 0, wide_string, -1, new_string, *length, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, wide_string, -1, new_string, *length, NULL, NULL);
return new_string; return new_string;
...@@ -114,7 +113,7 @@ static char *wide_to_utf8(LPCWSTR wide_string, int *length) ...@@ -114,7 +113,7 @@ static char *wide_to_utf8(LPCWSTR wide_string, int *length)
static WS_XML_STRING *populate_xml_string(LPCWSTR str) static WS_XML_STRING *populate_xml_string(LPCWSTR str)
{ {
WS_XML_STRING *xml = heap_alloc_zero(sizeof(WS_XML_STRING)); WS_XML_STRING *xml = calloc(1, sizeof(*xml));
int utf8Length; int utf8Length;
if (xml == NULL) if (xml == NULL)
...@@ -124,7 +123,7 @@ static WS_XML_STRING *populate_xml_string(LPCWSTR str) ...@@ -124,7 +123,7 @@ static WS_XML_STRING *populate_xml_string(LPCWSTR str)
if (xml->bytes == NULL) if (xml->bytes == NULL)
{ {
heap_free(xml); free(xml);
return NULL; return NULL;
} }
...@@ -140,9 +139,9 @@ static inline void free_xml_string(WS_XML_STRING *value) ...@@ -140,9 +139,9 @@ static inline void free_xml_string(WS_XML_STRING *value)
if (value == NULL) if (value == NULL)
return; return;
heap_free(value->bytes); free(value->bytes);
heap_free(value); free(value);
} }
static HRESULT write_xml_attribute(WSDXML_ATTRIBUTE *attribute, WS_XML_WRITER *writer) static HRESULT write_xml_attribute(WSDXML_ATTRIBUTE *attribute, WS_XML_WRITER *writer)
...@@ -850,7 +849,7 @@ static HRESULT write_and_send_message(IWSDiscoveryPublisherImpl *impl, WSD_SOAP_ ...@@ -850,7 +849,7 @@ static HRESULT write_and_send_message(IWSDiscoveryPublisherImpl *impl, WSD_SOAP_
if (ret != S_OK) return ret; if (ret != S_OK) return ret;
/* Prefix the XML header */ /* Prefix the XML header */
full_xml = heap_alloc(xml_length + xml_header_len + 1); full_xml = malloc(xml_length + xml_header_len + 1);
if (full_xml == NULL) if (full_xml == NULL)
{ {
...@@ -873,7 +872,7 @@ static HRESULT write_and_send_message(IWSDiscoveryPublisherImpl *impl, WSD_SOAP_ ...@@ -873,7 +872,7 @@ static HRESULT write_and_send_message(IWSDiscoveryPublisherImpl *impl, WSD_SOAP_
ret = send_udp_unicast(full_xml, xml_length + xml_header_len, remote_address, max_initial_delay); ret = send_udp_unicast(full_xml, xml_length + xml_header_len, remote_address, max_initial_delay);
} }
heap_free(full_xml); free(full_xml);
WsFreeHeap(heap); WsFreeHeap(heap);
return ret; return ret;
...@@ -1293,7 +1292,7 @@ static HRESULT wide_text_to_ulonglong(LPCWSTR text, ULONGLONG *value) ...@@ -1293,7 +1292,7 @@ static HRESULT wide_text_to_ulonglong(LPCWSTR text, ULONGLONG *value)
if (utf8_length == 1) return E_FAIL; if (utf8_length == 1) return E_FAIL;
ret = str_to_uint64((const unsigned char *) utf8_text, utf8_length - 1, MAX_UINT64, value); ret = str_to_uint64((const unsigned char *) utf8_text, utf8_length - 1, MAX_UINT64, value);
heap_free(utf8_text); free(utf8_text);
return ret; return ret;
} }
...@@ -1635,15 +1634,15 @@ static BOOL is_duplicate_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id) ...@@ -1635,15 +1634,15 @@ static BOOL is_duplicate_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id)
} }
} }
msg_id = heap_alloc(sizeof(*msg_id)); msg_id = malloc(sizeof(*msg_id));
if (!msg_id) goto end; if (!msg_id) goto end;
len = (lstrlenW(id) + 1) * sizeof(WCHAR); len = (lstrlenW(id) + 1) * sizeof(WCHAR);
msg_id->id = heap_alloc(len); msg_id->id = malloc(len);
if (!msg_id->id) if (!msg_id->id)
{ {
heap_free(msg_id); free(msg_id);
goto end; goto end;
} }
......
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