# HG changeset patch # User Anselm R Garbe # Date 1247065536 -3600 # Node ID 8fcc541b5238d27f77256d47789b344fe65cb075 # Parent d012c6babc13a3c65bd41ec109619a0293532ed0 die if malloc sizeof(Monitor) fails diff -r d012c6babc13 -r 8fcc541b5238 dwm.c --- a/dwm.c Mon Jul 06 20:12:47 2009 +0100 +++ b/dwm.c Wed Jul 08 16:05:36 2009 +0100 @@ -1693,7 +1693,8 @@ #endif /* XINERAMA */ /* allocate monitor(s) for the new geometry setup */ for(i = 0; i < n; i++) { - m = (Monitor *)malloc(sizeof(Monitor)); + if(!(m = (Monitor *)malloc(sizeof(Monitor)))) + die("fatal: could not malloc() %u bytes\n", sizeof(Monitor)); m->next = newmons; newmons = m; }