Fixed bugs in config.c & mlvwm.c where calloc() was being used to accidentally allocate memory for a number of MlvwmWindows instead of just a number of pointers to MlvwmWindows for Scr.LastActive, as identified by clang scan-build. Issue #48

This commit is contained in:
Morgan Aldridge
2024-09-02 12:49:08 -04:00
parent e04bf6a127
commit 548842fd9c
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -409,7 +409,7 @@ void SetDeskTopNum( char *line, FILE *fp )
AddMenuItem( &(Scr.IconMenu), label, action, NULL, NULL, NULL, STRGRAY );
if( Scr.LastActive!=NULL )
free( Scr.LastActive );
Scr.LastActive = calloc( Scr.n_desktop, sizeof(MlvwmWindow));
Scr.LastActive = calloc( Scr.n_desktop, sizeof(MlvwmWindow*));
}
void SetRstPrevState( char *line, FILE *fp )
+1 -1
View File
@@ -176,7 +176,7 @@ void InitScrParams( void )
Scr.MlvwmRoot.w = Scr.Root;
Scr.MlvwmRoot.prev = NULL;
Scr.MlvwmRoot.next = NULL;
Scr.LastActive = calloc( 1, sizeof(MlvwmWindow));
Scr.LastActive = calloc( 1, sizeof(MlvwmWindow*));
Scr.MyDisplayWidth = DisplayWidth( dpy, Scr.screen );
Scr.MyDisplayHeight = DisplayHeight( dpy, Scr.screen );
Scr.MenuLabelRoot = NULL;