From: Christophe CURIS <christophe.cu...@free.fr>

As pointed by Coverity, it is possible that RCreateContext fails for more
reasons that were handled by wScreenInit, so we provide an error message
for the other cases along with cleaner return from function.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 src/screen.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/screen.c b/src/screen.c
index 36943fb..51e2317 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -577,6 +577,11 @@ WScreen *wScreenInit(int screen_number)
 
                scr->rcontext = RCreateContext(dpy, screen_number, &rattr);
        }
+       if (scr->rcontext == NULL) {
+               wfatal(_("can't create Context on screen %d, %s"),
+                      screen_number, RMessageForError(RErrorCode));
+               goto abort_no_context;
+       }
 
        scr->w_win = scr->rcontext->drawable;
        scr->w_visual = scr->rcontext->visual;
@@ -589,6 +594,7 @@ WScreen *wScreenInit(int screen_number)
        if (!scr->wmscreen) {
                wfatal(_("could not initialize WINGs widget set"));
                RDestroyContext(scr->rcontext);
+       abort_no_context:
                WMFreeArray(scr->fakeGroupLeaders);
                wfree(scr->totalUsableArea);
                wfree(scr->usableArea);
-- 
2.1.1


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to