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

As pointed by Coverity, the code was checking for NULL pointer to avoid
misbehaviour, but it actually dereferenced the pointer beforehand so the
crash would still happen.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 WINGs/wcolorpanel.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/WINGs/wcolorpanel.c b/WINGs/wcolorpanel.c
index b61b336..60655cd 100644
--- a/WINGs/wcolorpanel.c
+++ b/WINGs/wcolorpanel.c
@@ -1097,15 +1097,16 @@ WMColorPanel *WMGetColorPanel(WMScreen * scrPtr)
 
 void WMFreeColorPanel(WMColorPanel * panel)
 {
-       W_Screen *scr = WMWidgetScreen(panel->win);
+       W_Screen *scr;
+
+       if (!panel)
+               return;
 
+       scr = WMWidgetScreen(panel->win);
        if (panel == scr->sharedColorPanel) {
                scr->sharedColorPanel = NULL;
        }
 
-       if (!panel)
-               return;
-
        WMRemoveNotificationObserver(panel);
        WMUnmapWidget(panel->win);
 
-- 
1.9.2


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

Reply via email to