From 38463df1024bd96448da0fd86257788d0ac4dc9d Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 15 Nov 2014 19:40:47 +0100 Subject: [PATCH] wmaker: fix incomplete null pointer check in wFrameWindowChangeTitle (Coverity #50058) As pointed by Coverity, despite the numerous null pointer checks there is still a case where one can pass trough and make wmaker crash. This patch simplifies it all but making only one check at the beginning so the code is safe and the remaining is simpler. Signed-off-by: Christophe CURIS Signed-off-by: Carlos R. Mafra --- src/framewin.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/framewin.c b/src/framewin.c index 13fe1e09..d045f63a 100644 --- a/src/framewin.c +++ b/src/framewin.c @@ -1205,12 +1205,12 @@ void wFrameWindowResize(WFrameWindow * fwin, int width, int height) int wFrameWindowChangeTitle(WFrameWindow *fwin, const char *new_title) { + if (new_title == NULL) + return 0; + /* check if the title is the same as before */ if (fwin->title) { - if (new_title && (strcmp(fwin->title, new_title) == 0)) - return 0; - } else { - if (!new_title) + if (strcmp(fwin->title, new_title) == 0) return 0; }