wineconsole: Avoid some fatal errors.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2017-05-17 22:20:40 +02:00
parent d321cdcd28
commit 9032849d06
3 changed files with 5 additions and 10 deletions

View file

@ -76,7 +76,7 @@ static LPWSTR WINECON_CreateKeyName(LPCWSTR kn)
LPWSTR ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(kn) + 1) * sizeof(WCHAR)); LPWSTR ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(kn) + 1) * sizeof(WCHAR));
LPWSTR ptr = ret; LPWSTR ptr = ret;
if (!ptr) WINECON_Fatal("OOM"); if (!ret) return NULL;
do do
{ {

View file

@ -56,8 +56,7 @@ static void WCUSER_FillMemDC(const struct inner_data* data, int upd_tp, int upd_
/* FIXME: could set up a mechanism to reuse the line between different /* FIXME: could set up a mechanism to reuse the line between different
* calls to this function * calls to this function
*/ */
if (!(line = HeapAlloc(GetProcessHeap(), 0, data->curcfg.sb_width * sizeof(WCHAR)))) if (!(line = HeapAlloc(GetProcessHeap(), 0, data->curcfg.sb_width * sizeof(WCHAR)))) return;
WINECON_Fatal("OOM\n");
dx = HeapAlloc( GetProcessHeap(), 0, data->curcfg.sb_width * sizeof(*dx) ); dx = HeapAlloc( GetProcessHeap(), 0, data->curcfg.sb_width * sizeof(*dx) );
hOldFont = SelectObject(PRIVATE(data)->hMemDC, PRIVATE(data)->hFont); hOldFont = SelectObject(PRIVATE(data)->hMemDC, PRIVATE(data)->hFont);
@ -169,7 +168,7 @@ static void WCUSER_ShapeCursor(struct inner_data* data, int size, int vis, BOOL
w16b = ((data->curcfg.cell_width + 15) & ~15) / 8; w16b = ((data->curcfg.cell_width + 15) & ~15) / 8;
ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, w16b * data->curcfg.cell_height); ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, w16b * data->curcfg.cell_height);
if (!ptr) WINECON_Fatal("OOM"); if (!ptr) return;
nbl = max((data->curcfg.cell_height * size) / 100, 1); nbl = max((data->curcfg.cell_height * size) / 100, 1);
for (j = data->curcfg.cell_height - nbl; j < data->curcfg.cell_height; j++) for (j = data->curcfg.cell_height - nbl; j < data->curcfg.cell_height; j++)
{ {

View file

@ -655,11 +655,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
GetStartupInfoW(&si); GetStartupInfoW(&si);
if (pid == 0) if (pid == 0) appname = si.lpTitle;
{
if (!si.lpTitle) WINECON_Fatal("Should have a title set");
appname = si.lpTitle;
}
data->nCmdShow = nCmdShow; data->nCmdShow = nCmdShow;
/* load settings */ /* load settings */
@ -729,7 +725,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
WINECON_GetServerConfig(data); WINECON_GetServerConfig(data);
data->cells = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, data->cells = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
data->curcfg.sb_width * data->curcfg.sb_height * sizeof(CHAR_INFO)); data->curcfg.sb_width * data->curcfg.sb_height * sizeof(CHAR_INFO));
if (!data->cells) WINECON_Fatal("OOM\n"); if (!data->cells) goto error;
data->fnResizeScreenBuffer(data); data->fnResizeScreenBuffer(data);
data->fnComputePositions(data); data->fnComputePositions(data);
WINECON_SetConfig(data, &cfg); WINECON_SetConfig(data, &cfg);