Alexandre Julliard : wineconsole: Avoid some fatal errors.

Alexandre Julliard julliard at winehq.org
Wed May 17 15:58:30 CDT 2017


Module: wine
Branch: master
Commit: 9032849d068a8a0a026c12b62a1a25c3cff53d63
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9032849d068a8a0a026c12b62a1a25c3cff53d63

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May 17 22:20:40 2017 +0200

wineconsole: Avoid some fatal errors.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/wineconsole/registry.c    | 2 +-
 programs/wineconsole/user.c        | 5 ++---
 programs/wineconsole/wineconsole.c | 8 ++------
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/programs/wineconsole/registry.c b/programs/wineconsole/registry.c
index e537a86..080431a 100644
--- a/programs/wineconsole/registry.c
+++ b/programs/wineconsole/registry.c
@@ -76,7 +76,7 @@ static LPWSTR   WINECON_CreateKeyName(LPCWSTR kn)
     LPWSTR      ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(kn) + 1) * sizeof(WCHAR));
     LPWSTR      ptr = ret;
 
-    if (!ptr) WINECON_Fatal("OOM");
+    if (!ret) return NULL;
 
     do
     {
diff --git a/programs/wineconsole/user.c b/programs/wineconsole/user.c
index 316c011..fe1cf46 100644
--- a/programs/wineconsole/user.c
+++ b/programs/wineconsole/user.c
@@ -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
      * calls to this function
      */
-    if (!(line = HeapAlloc(GetProcessHeap(), 0, data->curcfg.sb_width * sizeof(WCHAR))))
-        WINECON_Fatal("OOM\n");
+    if (!(line = HeapAlloc(GetProcessHeap(), 0, data->curcfg.sb_width * sizeof(WCHAR)))) return;
     dx = HeapAlloc( GetProcessHeap(), 0, data->curcfg.sb_width * sizeof(*dx) );
 
     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;
 	    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);
 	    for (j = data->curcfg.cell_height - nbl; j < data->curcfg.cell_height; j++)
 	    {
diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c
index d6efa2f..d1d38be 100644
--- a/programs/wineconsole/wineconsole.c
+++ b/programs/wineconsole/wineconsole.c
@@ -655,11 +655,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
 
     GetStartupInfoW(&si);
 
-    if (pid == 0)
-    {
-        if (!si.lpTitle) WINECON_Fatal("Should have a title set");
-        appname = si.lpTitle;
-    }
+    if (pid == 0) appname = si.lpTitle;
 
     data->nCmdShow = nCmdShow;
     /* load settings */
@@ -729,7 +725,7 @@ static struct inner_data* WINECON_Init(HINSTANCE hInst, DWORD pid, LPCWSTR appna
         WINECON_GetServerConfig(data);
         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");
+        if (!data->cells) goto error;
         data->fnResizeScreenBuffer(data);
         data->fnComputePositions(data);
         WINECON_SetConfig(data, &cfg);




More information about the wine-cvs mailing list