From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmsynth/synth.c | 9 +++------ dlls/dmsynth/synthsink.c | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c index 30b7eee6808..00883505377 100644 --- a/dlls/dmsynth/synth.c +++ b/dlls/dmsynth/synth.c @@ -96,7 +96,7 @@ static ULONG WINAPI synth_Release(IDirectMusicSynth8 *iface) if (!ref) { if (This->latency_clock) IReferenceClock_Release(This->latency_clock); - HeapFree(GetProcessHeap(), 0, This); + free(This); }
return ref; @@ -744,11 +744,8 @@ HRESULT DMUSIC_CreateDirectMusicSynthImpl(REFIID riid, void **ppobj)
TRACE("(%s, %p)\n", debugstr_guid(riid), ppobj);
- obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj)); - if (NULL == obj) { - *ppobj = NULL; - return E_OUTOFMEMORY; - } + *ppobj = NULL; + if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY; obj->IDirectMusicSynth8_iface.lpVtbl = &synth_vtbl; obj->IKsControl_iface.lpVtbl = &synth_control_vtbl; obj->ref = 1; diff --git a/dlls/dmsynth/synthsink.c b/dlls/dmsynth/synthsink.c index 73c623585be..fce325681ee 100644 --- a/dlls/dmsynth/synthsink.c +++ b/dlls/dmsynth/synthsink.c @@ -92,7 +92,7 @@ static ULONG WINAPI synth_sink_Release(IDirectMusicSynthSink *iface) IReferenceClock_Release(This->latency_clock); if (This->master_clock) IReferenceClock_Release(This->master_clock); - HeapFree(GetProcessHeap(), 0, This); + free(This); }
return ref; @@ -315,10 +315,7 @@ HRESULT DMUSIC_CreateDirectMusicSynthSinkImpl(REFIID riid, void **ret_iface)
*ret_iface = NULL;
- obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct synth_sink)); - if (!obj) - return E_OUTOFMEMORY; - + if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY; obj->IDirectMusicSynthSink_iface.lpVtbl = &synth_sink_vtbl; obj->IKsControl_iface.lpVtbl = &synth_sink_control; obj->ref = 1; @@ -326,7 +323,7 @@ HRESULT DMUSIC_CreateDirectMusicSynthSinkImpl(REFIID riid, void **ret_iface) hr = CoCreateInstance(&CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER, &IID_IReferenceClock, (LPVOID*)&obj->latency_clock); if (FAILED(hr)) { - HeapFree(GetProcessHeap(), 0, obj); + free(obj); return hr; }