mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-04 18:57:38 +00:00
dmusic: Use CRT allocation functions.
This commit is contained in:
parent
096377be42
commit
4ef31ae987
|
@ -69,8 +69,8 @@ static ULONG WINAPI IDirectMusicBufferImpl_Release(LPDIRECTMUSICBUFFER iface)
|
|||
TRACE("(%p): new ref = %lu\n", iface, ref);
|
||||
|
||||
if (!ref) {
|
||||
HeapFree(GetProcessHeap(), 0, This->data);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This->data);
|
||||
free(This);
|
||||
DMUSIC_UnlockModule();
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_i
|
|||
|
||||
*ret_iface = NULL;
|
||||
|
||||
dmbuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBufferImpl));
|
||||
dmbuffer = calloc(1, sizeof(IDirectMusicBufferImpl));
|
||||
if (!dmbuffer)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -313,9 +313,9 @@ HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_i
|
|||
dmbuffer->format = desc->guidBufferFormat;
|
||||
dmbuffer->size = (desc->cbBuffer + 3) & ~3; /* Buffer size must be multiple of 4 bytes */
|
||||
|
||||
dmbuffer->data = HeapAlloc(GetProcessHeap(), 0, dmbuffer->size);
|
||||
dmbuffer->data = malloc(dmbuffer->size);
|
||||
if (!dmbuffer->data) {
|
||||
HeapFree(GetProcessHeap(), 0, dmbuffer);
|
||||
free(dmbuffer);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ static ULONG WINAPI IReferenceClockImpl_Release(IReferenceClock *iface)
|
|||
TRACE("(%p): new ref = %lu\n", This, ref);
|
||||
|
||||
if (!ref) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This);
|
||||
DMUSIC_UnlockModule();
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNO
|
|||
|
||||
TRACE("(%s, %p, %p)\n", debugstr_guid(riid), ret_iface, unkouter);
|
||||
|
||||
clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl));
|
||||
clock = calloc(1, sizeof(IReferenceClockImpl));
|
||||
if (!clock) {
|
||||
*ret_iface = NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
|
|
|
@ -98,7 +98,7 @@ static ULONG WINAPI IDirectMusicCollectionImpl_Release(IDirectMusicCollection *i
|
|||
TRACE("(%p): new ref = %lu\n", iface, ref);
|
||||
|
||||
if (!ref) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This);
|
||||
DMUSIC_UnlockModule();
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface,
|
|||
switch (chunk.fccID) {
|
||||
case FOURCC_COLH: {
|
||||
TRACE_(dmfile)(": collection header chunk\n");
|
||||
This->pHeader = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, chunk.dwSize);
|
||||
This->pHeader = calloc(1, chunk.dwSize);
|
||||
IStream_Read(stream, This->pHeader, chunk.dwSize, NULL);
|
||||
break;
|
||||
}
|
||||
|
@ -275,10 +275,10 @@ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface,
|
|||
}
|
||||
case FOURCC_PTBL: {
|
||||
TRACE_(dmfile)(": pool table chunk\n");
|
||||
This->pPoolTable = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(POOLTABLE));
|
||||
This->pPoolTable = calloc(1, sizeof(POOLTABLE));
|
||||
IStream_Read(stream, This->pPoolTable, sizeof(POOLTABLE), NULL);
|
||||
chunk.dwSize -= sizeof(POOLTABLE);
|
||||
This->pPoolCues = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pPoolTable->cCues * sizeof(POOLCUE));
|
||||
This->pPoolCues = calloc(This->pPoolTable->cCues, sizeof(POOLCUE));
|
||||
IStream_Read(stream, This->pPoolCues, chunk.dwSize, NULL);
|
||||
break;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface,
|
|||
}
|
||||
case mmioFOURCC('I','C','O','P'): {
|
||||
TRACE_(dmfile)(": copyright chunk\n");
|
||||
This->szCopyright = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, chunk.dwSize);
|
||||
This->szCopyright = calloc(1, chunk.dwSize);
|
||||
IStream_Read(stream, This->szCopyright, chunk.dwSize, NULL);
|
||||
if (even_or_odd(chunk.dwSize)) {
|
||||
ListCount[0]++;
|
||||
|
@ -387,7 +387,7 @@ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface,
|
|||
ListCount[1] = 0;
|
||||
switch (chunk.fccID) {
|
||||
case FOURCC_INS: {
|
||||
LPDMUS_PRIVATE_INSTRUMENTENTRY new_instrument = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_INSTRUMENTENTRY));
|
||||
DMUS_PRIVATE_INSTRUMENTENTRY *new_instrument = calloc(1, sizeof(DMUS_PRIVATE_INSTRUMENTENTRY));
|
||||
TRACE_(dmfile)(": instrument list\n");
|
||||
/* Only way to create this one... even M$ does it discretely */
|
||||
DMUSIC_CreateDirectMusicInstrumentImpl(&IID_IDirectMusicInstrument, (void**)&new_instrument->pInstrument, NULL);
|
||||
|
@ -531,7 +531,7 @@ HRESULT DMUSIC_CreateDirectMusicCollectionImpl(REFIID lpcGUID, void **ppobj, IUn
|
|||
if (pUnkOuter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicCollectionImpl));
|
||||
obj = calloc(1, sizeof(IDirectMusicCollectionImpl));
|
||||
if (!obj)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "dmusics.h"
|
||||
#include "dmobject.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmobj);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
|
||||
|
@ -375,7 +374,7 @@ HRESULT stream_next_chunk(IStream *stream, struct chunk_entry *chunk)
|
|||
/* Reads chunk data of the form:
|
||||
DWORD - size of array element
|
||||
element[] - Array of elements
|
||||
The caller needs to heap_free() the array.
|
||||
The caller needs to free() the array.
|
||||
*/
|
||||
HRESULT stream_chunk_get_array(IStream *stream, const struct chunk_entry *chunk, void **array,
|
||||
unsigned int *count, DWORD elem_size)
|
||||
|
@ -400,10 +399,10 @@ HRESULT stream_chunk_get_array(IStream *stream, const struct chunk_entry *chunk,
|
|||
|
||||
*count = (chunk->size - sizeof(DWORD)) / elem_size;
|
||||
size = *count * elem_size;
|
||||
if (!(*array = heap_alloc(size)))
|
||||
if (!(*array = malloc(size)))
|
||||
return E_OUTOFMEMORY;
|
||||
if (FAILED(hr = stream_read(stream, *array, size))) {
|
||||
heap_free(*array);
|
||||
free(*array);
|
||||
*array = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include "dmusic_private.h"
|
||||
#include "dmobject.h"
|
||||
#include "wine/heap.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
||||
|
||||
|
@ -75,7 +74,7 @@ static ULONG WINAPI master_IReferenceClock_Release(IReferenceClock *iface)
|
|||
TRACE("(%p) ref = %lu\n", iface, ref);
|
||||
|
||||
if (!ref)
|
||||
heap_free(This);
|
||||
free(This);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
@ -136,7 +135,7 @@ static HRESULT master_clock_create(IReferenceClock **clock)
|
|||
|
||||
TRACE("(%p)\n", clock);
|
||||
|
||||
if (!(obj = heap_alloc_zero(sizeof(*obj))))
|
||||
if (!(obj = calloc(1, sizeof(*obj))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
obj->IReferenceClock_iface.lpVtbl = &master_clock_vtbl;
|
||||
|
@ -199,9 +198,9 @@ static ULONG WINAPI IDirectMusic8Impl_Release(LPDIRECTMUSIC8 iface)
|
|||
IReferenceClock_Release(This->master_clock);
|
||||
if (This->dsound)
|
||||
IDirectSound_Release(This->dsound);
|
||||
HeapFree(GetProcessHeap(), 0, This->system_ports);
|
||||
HeapFree(GetProcessHeap(), 0, This->ports);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This->system_ports);
|
||||
free(This->ports);
|
||||
free(This);
|
||||
DMUSIC_UnlockModule();
|
||||
}
|
||||
|
||||
|
@ -283,12 +282,7 @@ static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSI
|
|||
return hr;
|
||||
}
|
||||
This->num_ports++;
|
||||
if (!This->ports)
|
||||
This->ports = HeapAlloc(GetProcessHeap(), 0,
|
||||
sizeof(*This->ports) * This->num_ports);
|
||||
else
|
||||
This->ports = HeapReAlloc(GetProcessHeap(), 0, This->ports,
|
||||
sizeof(*This->ports) * This->num_ports);
|
||||
This->ports = realloc(This->ports, sizeof(*This->ports) * This->num_ports);
|
||||
This->ports[This->num_ports - 1] = new_port;
|
||||
*port = new_port;
|
||||
return S_OK;
|
||||
|
@ -320,15 +314,14 @@ void dmusic_remove_port(IDirectMusic8Impl *dmusic, IDirectMusicPort *port)
|
|||
}
|
||||
|
||||
if (!--dmusic->num_ports) {
|
||||
HeapFree(GetProcessHeap(), 0, dmusic->ports);
|
||||
free(dmusic->ports);
|
||||
dmusic->ports = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
memmove(&dmusic->ports[i], &dmusic->ports[i + 1],
|
||||
(dmusic->num_ports - i) * sizeof(*dmusic->ports));
|
||||
dmusic->ports = HeapReAlloc(GetProcessHeap(), 0, dmusic->ports,
|
||||
sizeof(*dmusic->ports) * dmusic->num_ports);
|
||||
dmusic->ports = realloc(dmusic->ports, sizeof(*dmusic->ports) * dmusic->num_ports);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirectMusic8Impl_EnumMasterClock(LPDIRECTMUSIC8 iface, DWORD index, LPDMUS_CLOCKINFO clock_info)
|
||||
|
@ -517,7 +510,7 @@ static void create_system_ports_list(IDirectMusic8Impl* object)
|
|||
nb_midi_in = midiInGetNumDevs();
|
||||
nb_ports = 1 /* midi mapper */ + nb_midi_out + nb_midi_in + 1 /* synth port */;
|
||||
|
||||
port = object->system_ports = HeapAlloc(GetProcessHeap(), 0, nb_ports * sizeof(port_info));
|
||||
port = object->system_ports = malloc(nb_ports * sizeof(port_info));
|
||||
if (!object->system_ports)
|
||||
return;
|
||||
|
||||
|
@ -599,7 +592,7 @@ HRESULT DMUSIC_CreateDirectMusicImpl(REFIID riid, void **ret_iface, IUnknown *un
|
|||
if (unkouter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusic8Impl));
|
||||
dmusic = calloc(1, sizeof(IDirectMusic8Impl));
|
||||
if (!dmusic)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -607,7 +600,7 @@ HRESULT DMUSIC_CreateDirectMusicImpl(REFIID riid, void **ret_iface, IUnknown *un
|
|||
dmusic->ref = 1;
|
||||
ret = master_clock_create(&dmusic->master_clock);
|
||||
if (FAILED(ret)) {
|
||||
HeapFree(GetProcessHeap(), 0, dmusic);
|
||||
free(dmusic);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface
|
|||
TRACE("(%p): new ref = %lu\n", iface, ref);
|
||||
|
||||
if (!ref) {
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This);
|
||||
DMUSIC_UnlockModule();
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface,
|
|||
{
|
||||
IDirectMusicDownloadImpl *download;
|
||||
|
||||
download = HeapAlloc(GetProcessHeap(), 0, sizeof(*download));
|
||||
download = malloc(sizeof(*download));
|
||||
if (!download)
|
||||
{
|
||||
*ret_iface = NULL;
|
||||
|
|
|
@ -77,11 +77,11 @@ static ULONG WINAPI IDirectMusicInstrumentImpl_Release(LPDIRECTMUSICINSTRUMENT i
|
|||
{
|
||||
ULONG i;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->regions);
|
||||
free(This->regions);
|
||||
for (i = 0; i < This->nb_articulations; i++)
|
||||
HeapFree(GetProcessHeap(), 0, This->articulations->connections);
|
||||
HeapFree(GetProcessHeap(), 0, This->articulations);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This->articulations->connections);
|
||||
free(This->articulations);
|
||||
free(This);
|
||||
DMUSIC_UnlockModule();
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj,
|
|||
IDirectMusicInstrumentImpl* dminst;
|
||||
HRESULT hr;
|
||||
|
||||
dminst = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicInstrumentImpl));
|
||||
dminst = calloc(1, sizeof(IDirectMusicInstrumentImpl));
|
||||
if (NULL == dminst) {
|
||||
*ppobj = NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -257,10 +257,7 @@ static HRESULT load_articulation(IDirectMusicInstrumentImpl *This, IStream *stre
|
|||
HRESULT ret;
|
||||
instrument_articulation *articulation;
|
||||
|
||||
if (!This->articulations)
|
||||
This->articulations = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->articulations));
|
||||
else
|
||||
This->articulations = HeapReAlloc(GetProcessHeap(), 0, This->articulations, sizeof(*This->articulations) * (This->nb_articulations + 1));
|
||||
This->articulations = realloc(This->articulations, sizeof(*This->articulations) * (This->nb_articulations + 1));
|
||||
if (!This->articulations)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -270,14 +267,14 @@ static HRESULT load_articulation(IDirectMusicInstrumentImpl *This, IStream *stre
|
|||
if (FAILED(ret))
|
||||
return ret;
|
||||
|
||||
articulation->connections = HeapAlloc(GetProcessHeap(), 0, sizeof(CONNECTION) * articulation->connections_list.cConnections);
|
||||
articulation->connections = malloc(sizeof(CONNECTION) * articulation->connections_list.cConnections);
|
||||
if (!articulation->connections)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
ret = read_from_stream(stream, articulation->connections, sizeof(CONNECTION) * articulation->connections_list.cConnections);
|
||||
if (FAILED(ret))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, articulation->connections);
|
||||
free(articulation->connections);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -309,7 +306,7 @@ HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, ISt
|
|||
return DMUS_E_UNSUPPORTED_STREAM;
|
||||
}
|
||||
|
||||
This->regions = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->regions) * This->header.cRegions);
|
||||
This->regions = malloc(sizeof(*This->regions) * This->header.cRegions);
|
||||
if (!This->regions)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -438,7 +435,7 @@ HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, ISt
|
|||
return S_OK;
|
||||
|
||||
error:
|
||||
HeapFree(GetProcessHeap(), 0, This->regions);
|
||||
free(This->regions);
|
||||
This->regions = NULL;
|
||||
|
||||
return DMUS_E_UNSUPPORTED_STREAM;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <assert.h>
|
||||
#include "dmusic_private.h"
|
||||
#include "dmobject.h"
|
||||
#include "wine/heap.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
||||
|
||||
|
@ -104,8 +103,8 @@ static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_Release(LPDIRECTMUSICDO
|
|||
|
||||
if (!ref)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This->data);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This->data);
|
||||
free(This);
|
||||
DMUSIC_UnlockModule();
|
||||
}
|
||||
|
||||
|
@ -131,7 +130,7 @@ static HRESULT DMUSIC_CreateDirectMusicDownloadedInstrumentImpl(IDirectMusicDown
|
|||
{
|
||||
IDirectMusicDownloadedInstrumentImpl *object;
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
object = calloc(1, sizeof(*object));
|
||||
if (!object)
|
||||
{
|
||||
*instrument = NULL;
|
||||
|
@ -202,7 +201,7 @@ static ULONG WINAPI synth_port_Release(IDirectMusicPort *iface)
|
|||
IDirectSoundBuffer_Release(This->dsbuffer);
|
||||
if (This->dsound)
|
||||
IDirectSound_Release(This->dsound);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This);
|
||||
}
|
||||
|
||||
DMUSIC_UnlockModule();
|
||||
|
@ -255,7 +254,7 @@ static HRESULT WINAPI synth_port_DownloadInstrument(IDirectMusicPort *iface, IDi
|
|||
struct synth_port *This = synth_from_IDirectMusicPort(iface);
|
||||
IDirectMusicInstrumentImpl *instrument_object;
|
||||
HRESULT ret;
|
||||
BOOL free;
|
||||
BOOL on_heap;
|
||||
HANDLE download;
|
||||
DMUS_DOWNLOADINFO *info;
|
||||
DMUS_OFFSETTABLE *offset_table;
|
||||
|
@ -276,7 +275,7 @@ static HRESULT WINAPI synth_port_DownloadInstrument(IDirectMusicPort *iface, IDi
|
|||
nb_regions = instrument_object->header.cRegions;
|
||||
size = sizeof(DMUS_DOWNLOADINFO) + sizeof(ULONG) * (1 + nb_regions) + sizeof(DMUS_INSTRUMENT) + sizeof(DMUS_REGION) * nb_regions;
|
||||
|
||||
data = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
data = malloc(size);
|
||||
if (!data)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -317,7 +316,7 @@ static HRESULT WINAPI synth_port_DownloadInstrument(IDirectMusicPort *iface, IDi
|
|||
region->WLOOP[0] = instrument_object->regions[i].wave_loop;
|
||||
}
|
||||
|
||||
ret = IDirectMusicSynth8_Download(This->synth, &download, (VOID*)data, &free);
|
||||
ret = IDirectMusicSynth8_Download(This->synth, &download, (void*)data, &on_heap);
|
||||
|
||||
if (SUCCEEDED(ret))
|
||||
ret = DMUSIC_CreateDirectMusicDownloadedInstrumentImpl(downloaded_instrument);
|
||||
|
@ -331,7 +330,7 @@ static HRESULT WINAPI synth_port_DownloadInstrument(IDirectMusicPort *iface, IDi
|
|||
}
|
||||
|
||||
*downloaded_instrument = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
free(data);
|
||||
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -349,7 +348,7 @@ static HRESULT WINAPI synth_port_UnloadInstrument(IDirectMusicPort *iface,
|
|||
if (!downloaded_object->downloaded)
|
||||
return DMUS_E_NOT_DOWNLOADED_TO_PORT;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, downloaded_object->data);
|
||||
free(downloaded_object->data);
|
||||
downloaded_object->data = NULL;
|
||||
downloaded_object->downloaded = FALSE;
|
||||
|
||||
|
@ -779,7 +778,7 @@ HRESULT synth_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_param
|
|||
|
||||
*port = NULL;
|
||||
|
||||
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj));
|
||||
obj = calloc(1, sizeof(*obj));
|
||||
if (!obj)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -843,7 +842,7 @@ HRESULT synth_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_param
|
|||
IDirectMusicSynth_Release(obj->synth);
|
||||
if (obj->synth_sink)
|
||||
IDirectMusicSynthSink_Release(obj->synth_sink);
|
||||
HeapFree(GetProcessHeap(), 0, obj);
|
||||
free(obj);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
@ -902,7 +901,7 @@ static ULONG WINAPI midi_IDirectMusicPort_Release(IDirectMusicPort *iface)
|
|||
if (!ref) {
|
||||
if (This->clock)
|
||||
IReferenceClock_Release(This->clock);
|
||||
heap_free(This);
|
||||
free(This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -1124,7 +1123,7 @@ static HRESULT midi_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *para
|
|||
struct midi_port *obj;
|
||||
HRESULT hr;
|
||||
|
||||
if (!(obj = heap_alloc_zero(sizeof(*obj))))
|
||||
if (!(obj = calloc(1, sizeof(*obj))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
obj->IDirectMusicPort_iface.lpVtbl = &midi_port_vtbl;
|
||||
|
@ -1133,7 +1132,7 @@ static HRESULT midi_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *para
|
|||
|
||||
hr = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock, (void **)&obj->clock, NULL);
|
||||
if (hr != S_OK) {
|
||||
HeapFree(GetProcessHeap(), 0, obj);
|
||||
free(obj);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue