1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 06:38:05 +01:00

WMaker: Fixed crash if the RContext creation fail on a Screen (Coverity #50066)

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.curis@free.fr>
Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
This commit is contained in:
Christophe CURIS
2014-11-15 19:40:37 +01:00
committed by Carlos R. Mafra
parent 00f3ab0eaa
commit 810796b390

View File

@@ -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);