die if malloc sizeof(Monitor) fails
Anselm R Garbe garbeam@gmail.com
Wed, 08 Jul 2009 16:05:36 +0100
1 files changed,
2 insertions(+),
1 deletions(-)
jump to
M
dwm.c
→
dwm.c
@@ -1693,7 +1693,8 @@ info = XineramaQueryScreens(dpy, &n);
#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; }