die if malloc sizeof(Monitor) fails
This commit is contained in:
		
							parent
							
								
									a72dc2fec2
								
							
						
					
					
						commit
						61c3095f2f
					
				
							
								
								
									
										3
									
								
								dwm.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								dwm.c
									
									
									
									
									
								
							| @ -1693,7 +1693,8 @@ updategeom(void) { | |||||||
| #endif /* XINERAMA */ | #endif /* XINERAMA */ | ||||||
| 	/* allocate monitor(s) for the new geometry setup */ | 	/* allocate monitor(s) for the new geometry setup */ | ||||||
| 	for(i = 0; i < n; i++) { | 	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; | 		m->next = newmons; | ||||||
| 		newmons = m; | 		newmons = m; | ||||||
| 	} | 	} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user