grep - letting calloc() return NULL for 0 storage makes grep "" work
This commit is contained in:
		
							parent
							
								
									32f3d9842d
								
							
						
					
					
						commit
						5518fe9be1
					
				@ -516,7 +516,7 @@ grep_calloc(size_t nmemb, size_t size)
 | 
			
		||||
{
 | 
			
		||||
	void	*ptr;
 | 
			
		||||
 | 
			
		||||
	if ((ptr = calloc(nmemb, size)) == NULL)
 | 
			
		||||
	if ((ptr = calloc(nmemb, size)) == NULL && (size > 0) && (nmemb > 0))
 | 
			
		||||
		err(2, "calloc");
 | 
			
		||||
	return ptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user