Fix some instances of memory allocation through HeapReAlloc().

This commit is contained in:
Dimitrie O. Paun 2003-10-11 05:25:31 +00:00 committed by Alexandre Julliard
parent 9973af57e9
commit 921df719e5
3 changed files with 9 additions and 5 deletions

View File

@ -133,7 +133,8 @@ HRESULT WINAPI IDirectMusic8Impl_CreatePort (LPDIRECTMUSIC8 iface, REFCLSID rcls
TRACE("(%p, %s, %p, %p, %p)\n", This, debugstr_guid(rclsidPort), pPortParams, ppPort, pUnkOuter);
for (i = 0; S_FALSE != IDirectMusic8Impl_EnumPort(iface, i, &PortCaps); i++) {
if (IsEqualCLSID (rclsidPort, &PortCaps.guidPort)) {
This->ppPorts = HeapReAlloc(GetProcessHeap(), 0, This->ppPorts, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
if(!This->ppPorts) This->ppPorts = HeapAlloc(GetProcessHeap(), 0, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
else This->ppPorts = HeapReAlloc(GetProcessHeap(), 0, This->ppPorts, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
if (NULL == This->ppPorts[This->nrofports]) {
*ppPort = (LPDIRECTMUSICPORT)NULL;
return E_OUTOFMEMORY;

View File

@ -1339,7 +1339,9 @@ void DEBUG_InfoSymbols(const char* str)
{
if (num_used_array == num_alloc_array)
{
array = HeapReAlloc(GetProcessHeap(), 0, array, sizeof(*array) * (num_alloc_array += 32));
int size = sizeof(*array) * (num_alloc_array += 32);
if (!array) array = HeapAlloc(GetProcessHeap(), 0, size);
else array = HeapReAlloc(GetProcessHeap(), 0, array, size);
if (!array) return;
}
array[num_used_array++] = nh;

View File

@ -832,6 +832,7 @@ void MACRO_RegisterRoutine(LPCSTR dll, LPCSTR proc, LPCSTR args)
{
HANDLE hLib;
void (*fn)();
int size;
WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", dll, proc, args);
@ -849,9 +850,9 @@ void MACRO_RegisterRoutine(LPCSTR dll, LPCSTR proc, LPCSTR args)
}
/* FIXME: the library will not be unloaded until exit of program */
MACRO_Loaded = HeapReAlloc(GetProcessHeap(), 0, MACRO_Loaded,
++MACRO_NumLoaded * sizeof(struct MacroDesc));
size = ++MACRO_NumLoaded * sizeof(struct MacroDesc);
if (!MACRO_Loaded) MACRO_Loaded = HeapAlloc(GetProcessHeap(), 0, size);
else MACRO_Loaded = HeapReAlloc(GetProcessHeap(), 0, MACRO_Loaded, size);
MACRO_Loaded[MACRO_NumLoaded - 1].name = strdup(proc); /* FIXME */
MACRO_Loaded[MACRO_NumLoaded - 1].alias = NULL;
MACRO_Loaded[MACRO_NumLoaded - 1].isBool = 0;