Commit 8f26aaf2 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

sapi: Use CRT allocation functions.

parent 0f5fab24
......@@ -24,7 +24,6 @@
#include "winbase.h"
#include "objbase.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "wine/debug.h"
......@@ -58,7 +57,7 @@ void async_empty_queue(struct async_queue *queue)
LIST_FOR_EACH_ENTRY_SAFE(task, next, &queue->tasks, struct async_task, entry)
{
list_remove(&task->entry);
heap_free(task);
free(task);
}
LeaveCriticalSection(&queue->cs);
......@@ -87,7 +86,7 @@ static void CALLBACK async_worker(TP_CALLBACK_INSTANCE *instance, void *ctx)
{
ResetEvent(queue->empty);
task->proc(task);
heap_free(task);
free(task);
if (WaitForSingleObject(queue->cancel, 0) == WAIT_OBJECT_0)
goto cancel;
}
......
......@@ -95,7 +95,7 @@ static ULONG WINAPI file_stream_Release(ISpeechFileStream *iface)
if (!ref)
{
heap_free(This);
free(This);
}
return ref;
......@@ -375,7 +375,7 @@ const static ISpStreamVtbl spstream_vtbl =
HRESULT file_stream_create(IUnknown *outer, REFIID iid, void **obj)
{
struct file_stream *This = heap_alloc(sizeof(*This));
struct file_stream *This = malloc(sizeof(*This));
HRESULT hr;
if (!This) return E_OUTOFMEMORY;
......
......@@ -381,12 +381,12 @@ static ULONG WINAPI mmsysaudio_Release(ISpMMSysAudio *iface)
async_cancel_queue(&This->queue);
if (This->token) ISpObjectToken_Release(This->token);
heap_free(This->wfx);
free(This->wfx);
CloseHandle(This->event);
DeleteCriticalSection(&This->pending_cs);
DeleteCriticalSection(&This->cs);
heap_free(This);
free(This);
}
return ref;
......@@ -421,7 +421,7 @@ static HRESULT WINAPI mmsysaudio_Write(ISpMMSysAudio *iface, const void *pv, ULO
return SP_AUDIO_STOPPED;
}
if (!(buf = heap_alloc(sizeof(WAVEHDR) + cb)))
if (!(buf = malloc(sizeof(WAVEHDR) + cb)))
{
LeaveCriticalSection(&This->cs);
return E_OUTOFMEMORY;
......@@ -434,7 +434,7 @@ static HRESULT WINAPI mmsysaudio_Write(ISpMMSysAudio *iface, const void *pv, ULO
if (waveOutPrepareHeader(This->hwave.out, buf, sizeof(WAVEHDR)) != MMSYSERR_NOERROR)
{
LeaveCriticalSection(&This->cs);
heap_free(buf);
free(buf);
return E_FAIL;
}
......@@ -562,7 +562,7 @@ static void free_out_buf_proc(struct async_task *task)
TRACE("(%p).\n", task);
waveOutUnprepareHeader(fbt->audio->hwave.out, fbt->buf, sizeof(WAVEHDR));
heap_free(fbt->buf);
free(fbt->buf);
EnterCriticalSection(&fbt->audio->pending_cs);
buf_count = --fbt->audio->pending_buf_count;
......@@ -582,7 +582,7 @@ static void CALLBACK wave_out_proc(HWAVEOUT hwo, UINT msg, DWORD_PTR instance, D
switch (msg)
{
case WOM_DONE:
if (!(task = heap_alloc(sizeof(*task))))
if (!(task = malloc(sizeof(*task))))
{
ERR("failed to allocate free_buf_task.\n");
break;
......@@ -685,13 +685,13 @@ static HRESULT WINAPI mmsysaudio_SetFormat(ISpMMSysAudio *iface, const GUID *gui
return res == WAVERR_BADFORMAT ? SPERR_UNSUPPORTED_FORMAT : SPERR_GENERIC_MMSYS_ERROR;
}
if (!(new_wfx = heap_alloc(sizeof(*wfx) + wfx->cbSize)))
if (!(new_wfx = malloc(sizeof(*wfx) + wfx->cbSize)))
{
LeaveCriticalSection(&This->cs);
return E_OUTOFMEMORY;
}
memcpy(new_wfx, wfx, sizeof(*wfx) + wfx->cbSize);
heap_free(This->wfx);
free(This->wfx);
This->wfx = new_wfx;
LeaveCriticalSection(&This->cs);
......@@ -874,7 +874,7 @@ static HRESULT mmaudio_create(IUnknown *outer, REFIID iid, void **obj, enum flow
return E_NOTIMPL;
}
if (!(This = heap_alloc_zero(sizeof(*This))))
if (!(This = calloc(1, sizeof(*This))))
return E_OUTOFMEMORY;
This->ISpEventSource_iface.lpVtbl = &event_source_vtbl;
This->ISpEventSink_iface.lpVtbl = &event_sink_vtbl;
......@@ -887,9 +887,9 @@ static HRESULT mmaudio_create(IUnknown *outer, REFIID iid, void **obj, enum flow
This->device_id = WAVE_MAPPER;
This->state = SPAS_CLOSED;
if (!(This->wfx = heap_alloc(sizeof(*This->wfx))))
if (!(This->wfx = malloc(sizeof(*This->wfx))))
{
heap_free(This);
free(This);
return E_OUTOFMEMORY;
}
This->wfx->wFormatTag = WAVE_FORMAT_PCM;
......
......@@ -84,7 +84,7 @@ static ULONG WINAPI resource_manager_Release(ISpResourceManager *iface)
if (!ref)
{
heap_free(This);
free(This);
}
return ref;
......@@ -126,7 +126,7 @@ const static ISpResourceManagerVtbl resource_manager_vtbl =
HRESULT resource_manager_create(IUnknown *outer, REFIID iid, void **obj)
{
struct resource_manager *This = heap_alloc(sizeof(*This));
struct resource_manager *This = malloc(sizeof(*This));
HRESULT hr;
if (!This) return E_OUTOFMEMORY;
......
......@@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/heap.h"
#include "wine/list.h"
struct async_task
......
......@@ -84,7 +84,7 @@ static ULONG WINAPI spstream_Release(ISpStream *iface)
if (!ref)
{
heap_free(This);
free(This);
}
return ref;
......@@ -235,7 +235,7 @@ const static ISpStreamVtbl spstream_vtbl =
HRESULT speech_stream_create(IUnknown *outer, REFIID iid, void **obj)
{
struct spstream *This = heap_alloc(sizeof(*This));
struct spstream *This = malloc(sizeof(*This));
HRESULT hr;
if (!This) return E_OUTOFMEMORY;
......
......@@ -166,7 +166,7 @@ static ULONG WINAPI speech_voice_Release(ISpeechVoice *iface)
if (This->engine) ISpTTSEngine_Release(This->engine);
DeleteCriticalSection(&This->cs);
heap_free(This);
free(This);
}
return ref;
......@@ -822,7 +822,7 @@ done:
}
CoTaskMemFree(wfx);
if (engine) ISpTTSEngine_Release(engine);
heap_free(speak_task->frag_list);
free(speak_task->frag_list);
ISpTTSEngineSite_Release(speak_task->site);
if (speak_task->result)
......@@ -898,7 +898,7 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR
return hr;
}
if (!(frag = heap_alloc(sizeof(*frag) + contents_size)))
if (!(frag = malloc(sizeof(*frag) + contents_size)))
return E_OUTOFMEMORY;
memset(frag, 0, sizeof(*frag));
memcpy(frag + 1, contents, contents_size);
......@@ -915,7 +915,7 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR
goto fail;
}
speak_task = heap_alloc(sizeof(*speak_task));
speak_task = malloc(sizeof(*speak_task));
speak_task->task.proc = speak_proc;
speak_task->result = NULL;
......@@ -926,7 +926,7 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR
if (!(flags & SPF_ASYNC))
{
if (!(result = heap_alloc(sizeof(*result))))
if (!(result = malloc(sizeof(*result))))
{
hr = E_OUTOFMEMORY;
goto fail;
......@@ -952,18 +952,18 @@ static HRESULT WINAPI spvoice_Speak(ISpVoice *iface, const WCHAR *contents, DWOR
WaitForSingleObject(result->done, INFINITE);
hr = result->hr;
CloseHandle(result->done);
heap_free(result);
free(result);
return hr;
}
fail:
if (site) ISpTTSEngineSite_Release(site);
heap_free(frag);
heap_free(speak_task);
free(frag);
free(speak_task);
if (result)
{
CloseHandle(result->done);
heap_free(result);
free(result);
}
return hr;
}
......@@ -1210,7 +1210,7 @@ static ULONG WINAPI ttsenginesite_Release(ISpTTSEngineSite *iface)
{
if (This->voice)
ISpeechVoice_Release(&This->voice->ISpeechVoice_iface);
heap_free(This);
free(This);
}
return ref;
......@@ -1315,7 +1315,7 @@ const static ISpTTSEngineSiteVtbl ttsenginesite_vtbl =
static HRESULT ttsenginesite_create(struct speech_voice *voice, ULONG stream_num, ISpTTSEngineSite **site)
{
struct tts_engine_site *This = heap_alloc(sizeof(*This));
struct tts_engine_site *This = malloc(sizeof(*This));
if (!This) return E_OUTOFMEMORY;
......@@ -1387,7 +1387,7 @@ const static IConnectionPointContainerVtbl container_vtbl =
HRESULT speech_voice_create(IUnknown *outer, REFIID iid, void **obj)
{
struct speech_voice *This = heap_alloc(sizeof(*This));
struct speech_voice *This = malloc(sizeof(*This));
HRESULT hr;
if (!This) return E_OUTOFMEMORY;
......
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