From f60f14b7bdaeb9c2bc978d7e5207141245d3abd0 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 15 Nov 2014 19:40:34 +0100 Subject: [PATCH] WINGs: fix possible null pointer dereference in W_RealizeView (Coverity #50060) As pointed by Coverity, the function makes use of a pointer which may be null, so we have to properly check that to ensure application will not crash. Signed-off-by: Christophe CURIS Signed-off-by: Carlos R. Mafra --- WINGs/wview.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/WINGs/wview.c b/WINGs/wview.c index 1138f367..20662447 100644 --- a/WINGs/wview.c +++ b/WINGs/wview.c @@ -188,6 +188,12 @@ void W_RealizeView(W_View * view) } if (!view->flags.realized) { + + if (view->parent == NULL) { + wwarning("trying to realize widget without parent"); + return; + } + parentWID = view->parent->window; view->window = XCreateWindow(dpy, parentWID, view->pos.x, view->pos.y, view->size.width, view->size.height, 0,