Skip to content

Commit

Permalink
Fixed a null pointer being passed to strcmp() in menus.c's ChangeMenu…
Browse files Browse the repository at this point in the history
…Label() as identified by clang scan-build. Issue #48
  • Loading branch information
morgant committed Sep 1, 2024
1 parent 355d9ba commit a267980
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mlvwm/menus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a267980

Please sign in to comment.