Commit 8a02434c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dmcompos: Use CRT allocation functions.

parent 7d94983c
......@@ -79,9 +79,7 @@ static ULONG WINAPI IDirectMusicChordMapImpl_Release(IDirectMusicChordMap *iface
TRACE("(%p) ref=%ld\n", This, ref);
if (!ref) {
HeapFree(GetProcessHeap(), 0, This);
}
if (!ref) free(This);
return ref;
}
......@@ -310,23 +308,20 @@ static const IPersistStreamVtbl persiststream_vtbl = {
/* for ClassFactory */
HRESULT create_dmchordmap(REFIID lpcGUID, void **ppobj)
{
IDirectMusicChordMapImpl* obj;
HRESULT hr;
IDirectMusicChordMapImpl* obj;
HRESULT hr;
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapImpl));
if (NULL == obj) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
obj->IDirectMusicChordMap_iface.lpVtbl = &dmchordmap_vtbl;
obj->ref = 1;
dmobject_init(&obj->dmobj, &CLSID_DirectMusicChordMap,
(IUnknown *)&obj->IDirectMusicChordMap_iface);
obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl;
obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
*ppobj = NULL;
if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY;
obj->IDirectMusicChordMap_iface.lpVtbl = &dmchordmap_vtbl;
obj->ref = 1;
dmobject_init(&obj->dmobj, &CLSID_DirectMusicChordMap,
(IUnknown *)&obj->IDirectMusicChordMap_iface);
obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl;
obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
hr = IDirectMusicChordMap_QueryInterface(&obj->IDirectMusicChordMap_iface, lpcGUID, ppobj);
IDirectMusicChordMap_Release(&obj->IDirectMusicChordMap_iface);
hr = IDirectMusicChordMap_QueryInterface(&obj->IDirectMusicChordMap_iface, lpcGUID, ppobj);
IDirectMusicChordMap_Release(&obj->IDirectMusicChordMap_iface);
return hr;
return hr;
}
......@@ -77,9 +77,7 @@ static ULONG WINAPI chordmap_track_Release(IDirectMusicTrack8 *iface)
TRACE("(%p) ref=%ld\n", This, ref);
if (!ref) {
HeapFree(GetProcessHeap(), 0, This);
}
if (!ref) free(This);
return ref;
}
......@@ -289,11 +287,8 @@ HRESULT create_dmchordmaptrack(REFIID lpcGUID, void **ppobj)
IDirectMusicChordMapTrack* track;
HRESULT hr;
track = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
if (!track) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
*ppobj = NULL;
if (!(track = calloc(1, sizeof(*track)))) return E_OUTOFMEMORY;
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
track->ref = 1;
dmobject_init(&track->dmobj, &CLSID_DirectMusicChordMapTrack,
......
......@@ -67,9 +67,7 @@ static ULONG WINAPI IDirectMusicComposerImpl_Release(IDirectMusicComposer *iface
TRACE("(%p) ref=%ld\n", This, ref);
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
if (!ref) free(This);
return ref;
}
......@@ -174,11 +172,8 @@ HRESULT create_dmcomposer(REFIID riid, void **ret_iface)
IDirectMusicComposerImpl *obj;
HRESULT hr;
obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*obj));
if (!obj) {
*ret_iface = NULL;
return E_OUTOFMEMORY;
}
*ret_iface = NULL;
if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY;
obj->IDirectMusicComposer_iface.lpVtbl = &dmcomposer_vtbl;
obj->ref = 1;
......
......@@ -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;
}
......
......@@ -77,9 +77,7 @@ static ULONG WINAPI signpost_track_Release(IDirectMusicTrack8 *iface)
TRACE("(%p) ref=%ld\n", This, ref);
if (!ref) {
HeapFree(GetProcessHeap(), 0, This);
}
if (!ref) free(This);
return ref;
}
......@@ -277,11 +275,8 @@ HRESULT create_dmsignposttrack(REFIID lpcGUID, void **ppobj)
IDirectMusicSignPostTrack *track;
HRESULT hr;
track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*track));
if (!track) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
*ppobj = NULL;
if (!(track = calloc(1, sizeof(*track)))) return E_OUTOFMEMORY;
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
track->ref = 1;
dmobject_init(&track->dmobj, &CLSID_DirectMusicSignPostTrack,
......
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