From 61c3095f2f9b35a0b330b37c172daefae0278663 Mon Sep 17 00:00:00 2001 From: Anselm R Garbe Date: Wed, 8 Jul 2009 16:05:36 +0100 Subject: die if malloc sizeof(Monitor) fails --- dwm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index c0a15cc0..267659f3 100644 --- a/dwm.c +++ b/dwm.c @@ -1693,7 +1693,8 @@ updategeom(void) { #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; } -- cgit v1.2.3