mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 15:05:17 +00:00
Another portion of HeapReAlloc fixes.
This commit is contained in:
parent
8c4ef67452
commit
cf8b84c19f
|
@ -564,9 +564,15 @@ static BOOL MMDRV_InitPerType(LPWINE_MM_DRIVER lpDrv, UINT type, UINT wMsg)
|
|||
part->nIDMin, part->nIDMax, llTypes[type].wMaxId,
|
||||
lpDrv->drvname, llTypes[type].typestr);
|
||||
/* realloc translation table */
|
||||
llTypes[type].lpMlds = (LPWINE_MLD)
|
||||
HeapReAlloc(GetProcessHeap(), 0, (llTypes[type].lpMlds) ? llTypes[type].lpMlds - 1 : NULL,
|
||||
if (llTypes[type].lpMlds)
|
||||
llTypes[type].lpMlds = (LPWINE_MLD)
|
||||
HeapReAlloc(GetProcessHeap(), 0, llTypes[type].lpMlds - 1,
|
||||
sizeof(WINE_MLD) * (llTypes[type].wMaxId + 1)) + 1;
|
||||
else
|
||||
llTypes[type].lpMlds = (LPWINE_MLD)
|
||||
HeapAlloc(GetProcessHeap(), 0,
|
||||
sizeof(WINE_MLD) * (llTypes[type].wMaxId + 1)) + 1;
|
||||
|
||||
/* re-build the translation table */
|
||||
if (llTypes[type].nMapper != -1) {
|
||||
TRACE("%s:Trans[%d] -> %s\n", llTypes[type].typestr, -1, MMDrvs[llTypes[type].nMapper].drvname);
|
||||
|
|
|
@ -126,10 +126,15 @@ static void CALLBACK TIME_MMSysTimeCallback(LPWINE_MM_IDATA iData)
|
|||
lpTimer->uCurTime += lpTimer->wDelay - MMSYSTIME_MININTERVAL;
|
||||
if (lpTimer->lpFunc) {
|
||||
if (idx == iData->nSizeLpTimers) {
|
||||
iData->lpTimers = (LPWINE_TIMERENTRY)
|
||||
if (iData->lpTimers)
|
||||
iData->lpTimers = (LPWINE_TIMERENTRY)
|
||||
HeapReAlloc(GetProcessHeap(), 0,
|
||||
iData->lpTimers,
|
||||
++iData->nSizeLpTimers * sizeof(WINE_TIMERENTRY));
|
||||
else
|
||||
iData->lpTimers = (LPWINE_TIMERENTRY)
|
||||
HeapAlloc(GetProcessHeap(), 0,
|
||||
++iData->nSizeLpTimers * sizeof(WINE_TIMERENTRY));
|
||||
}
|
||||
iData->lpTimers[idx++] = *lpTimer;
|
||||
}
|
||||
|
|
|
@ -450,7 +450,11 @@ int JACK_bufsize (nframes_t nframes, void *arg)
|
|||
wwo->buffer_size, buffer_required);
|
||||
TRACE("GetProcessHeap() == %p\n", GetProcessHeap());
|
||||
wwo->buffer_size = buffer_required;
|
||||
wwo->sound_buffer = HeapReAlloc(GetProcessHeap(), 0, wwo->sound_buffer, wwo->buffer_size);
|
||||
|
||||
if (wwo->sound_buffer)
|
||||
wwo->sound_buffer = HeapReAlloc(GetProcessHeap(), 0, wwo->sound_buffer, wwo->buffer_size);
|
||||
else
|
||||
wwo->sound_buffer = HeapAlloc(GetProcessHeap(), 0, wwo->buffer_size);
|
||||
|
||||
/* if we don't have a buffer then error out */
|
||||
if(!wwo->sound_buffer)
|
||||
|
|
|
@ -3341,8 +3341,13 @@ static HRESULT WINAPI IDsDriverNotifyImpl_SetNotificationPositions(
|
|||
|
||||
/* Make an internal copy of the caller-supplied array.
|
||||
* Replace the existing copy if one is already present. */
|
||||
This->notifies = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
This->notifies, howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
if (This->notifies)
|
||||
This->notifies = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
This->notifies, howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
else
|
||||
This->notifies = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
|
||||
memcpy(This->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
This->nrofnotifies = howmuch;
|
||||
|
||||
|
|
|
@ -430,8 +430,14 @@ static HANDLE WINSPOOL_GetOpenedPrinterEntry( LPCWSTR name )
|
|||
|
||||
if (i >= nb_printers)
|
||||
{
|
||||
LPWSTR *new_array = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, printer_array,
|
||||
LPWSTR *new_array;
|
||||
if (printer_array)
|
||||
new_array = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, printer_array,
|
||||
(nb_printers + 16) * sizeof(*new_array) );
|
||||
else
|
||||
new_array = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
(nb_printers + 16) * sizeof(*new_array) );
|
||||
|
||||
if (!new_array) return 0;
|
||||
printer_array = new_array;
|
||||
nb_printers += 16;
|
||||
|
|
|
@ -1062,9 +1062,13 @@ static UINT X11DRV_PALETTE_SetMapping( PALETTEOBJ* palPtr, UINT uStart, UINT uNu
|
|||
X11DRV_PALETTE_FormatSystemPalette();
|
||||
|
||||
/* initialize palette mapping table */
|
||||
|
||||
mapping = HeapReAlloc( GetProcessHeap(), 0, palPtr->mapping,
|
||||
if (palPtr->mapping)
|
||||
mapping = HeapReAlloc( GetProcessHeap(), 0, palPtr->mapping,
|
||||
sizeof(int)*palPtr->logpalette.palNumEntries);
|
||||
else
|
||||
mapping = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(int)*palPtr->logpalette.palNumEntries);
|
||||
|
||||
if(mapping == NULL) {
|
||||
ERR("Can not allocate new mapping -- memory exausted!\n");
|
||||
return 0;
|
||||
|
|
|
@ -223,7 +223,11 @@ static void WCCURSES_ResizeScreenBuffer(struct inner_data* data)
|
|||
PRIVATE(data)->pad = newpad(data->curcfg.sb_height, data->curcfg.sb_width);
|
||||
if (!PRIVATE(data)->pad)
|
||||
WINE_FIXME("Cannot create pad\n");
|
||||
PRIVATE(data)->line = HeapReAlloc(GetProcessHeap(), 0, PRIVATE(data)->line,
|
||||
if (PRIVATE(data)->line)
|
||||
PRIVATE(data)->line = HeapReAlloc(GetProcessHeap(), 0, PRIVATE(data)->line,
|
||||
sizeof(chtype) * data->curcfg.sb_width);
|
||||
else
|
||||
PRIVATE(data)->line = HeapAlloc(GetProcessHeap(), 0,
|
||||
sizeof(chtype) * data->curcfg.sb_width);
|
||||
}
|
||||
|
||||
|
|
|
@ -291,8 +291,13 @@ int WINECON_GrabChanges(struct inner_data* data)
|
|||
data->curcfg.sb_width = evts[i].u.resize.width;
|
||||
data->curcfg.sb_height = evts[i].u.resize.height;
|
||||
|
||||
data->cells = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, data->cells,
|
||||
if (data->cells)
|
||||
data->cells = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, data->cells,
|
||||
data->curcfg.sb_width * data->curcfg.sb_height * sizeof(CHAR_INFO));
|
||||
else
|
||||
data->cells = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
data->curcfg.sb_width * data->curcfg.sb_height * sizeof(CHAR_INFO));
|
||||
|
||||
if (!data->cells) WINECON_Fatal("OOM\n");
|
||||
data->fnResizeScreenBuffer(data);
|
||||
data->fnComputePositions(data);
|
||||
|
|
|
@ -776,8 +776,13 @@ static BOOL HLPFILE_LoadGfxByIndex(HLPFILE *hlpfile, unsigned index,
|
|||
if (index >= hlpfile->numBmps)
|
||||
{
|
||||
hlpfile->numBmps = index + 1;
|
||||
hlpfile->bmps = HeapReAlloc(GetProcessHeap(), 0, hlpfile->bmps,
|
||||
if (hlpfile->bmps)
|
||||
hlpfile->bmps = HeapReAlloc(GetProcessHeap(), 0, hlpfile->bmps,
|
||||
hlpfile->numBmps * sizeof(hlpfile->bmps[0]));
|
||||
else
|
||||
hlpfile->bmps = HeapAlloc(GetProcessHeap(), 0,
|
||||
hlpfile->numBmps * sizeof(hlpfile->bmps[0]));
|
||||
|
||||
}
|
||||
hlpfile->bmps[index] = paragraph->u.gfx.u.bmp.hBitmap;
|
||||
}
|
||||
|
@ -1395,8 +1400,14 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile)
|
|||
|
||||
case 6:
|
||||
if (GET_USHORT(ptr, 2) != 90) {WINE_WARN("system6\n");break;}
|
||||
hlpfile->windows = HeapReAlloc(GetProcessHeap(), 0, hlpfile->windows,
|
||||
|
||||
if (hlpfile->windows)
|
||||
hlpfile->windows = HeapReAlloc(GetProcessHeap(), 0, hlpfile->windows,
|
||||
sizeof(HLPFILE_WINDOWINFO) * ++hlpfile->numWindows);
|
||||
else
|
||||
hlpfile->windows = HeapAlloc(GetProcessHeap(), 0,
|
||||
sizeof(HLPFILE_WINDOWINFO) * ++hlpfile->numWindows);
|
||||
|
||||
if (hlpfile->windows)
|
||||
{
|
||||
unsigned flags = GET_USHORT(ptr, 4);
|
||||
|
|
Loading…
Reference in a new issue