From a2679804a9fee815d5752389a3e5d851864fc69a Mon Sep 17 00:00:00 2001 From: Morgan Aldridge Date: Sun, 1 Sep 2024 18:12:51 -0400 Subject: [PATCH] Fixed a null pointer being passed to strcmp() in menus.c's ChangeMenuLabel() as identified by clang scan-build. Issue #48 --- mlvwm/menus.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mlvwm/menus.c b/mlvwm/menus.c index 5749ca2..f0bd0e1 100644 --- a/mlvwm/menus.c +++ b/mlvwm/menus.c @@ -1409,9 +1409,8 @@ void MapMenuBar( MlvwmWindow *win ) void ChangeMenuLabel( MenuLabel *ml, char *newl, Icon *miniicon ) { if( newl==NULL && ml->xpm==miniicon ) return; - if( ml->LabelStr && !strcmp(ml->LabelStr, newl )){ - if( ml->LabelStr ) - free( ml->LabelStr ); + if(( ml->LabelStr && newl && !strcmp(ml->LabelStr, newl )) || (ml->LabelStr && !newl)) { + free( ml->LabelStr ); ml->LabelStr = newl; } ml->xpm = miniicon;