print error only in debug mode
This commit is contained in:
		
							
								
								
									
										11
									
								
								src/malloc.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/malloc.c
									
									
									
									
									
								
							@ -122,12 +122,10 @@ void ft_free(void *ptr)
 | 
			
		||||
 | 
			
		||||
	for (i = TINY; i <= LARGE + 1; i++)
 | 
			
		||||
	{
 | 
			
		||||
#ifndef DEBUG
 | 
			
		||||
		if (i > LARGE)
 | 
			
		||||
		{
 | 
			
		||||
			// THROW ERROR
 | 
			
		||||
			write(2, "chunk not found\n", 16);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
		root = allocs_tree[i];
 | 
			
		||||
		
 | 
			
		||||
		raw_chunk = raw_get_chunk(root, ptr);
 | 
			
		||||
@ -139,11 +137,10 @@ void ft_free(void *ptr)
 | 
			
		||||
 | 
			
		||||
	chunk_read(raw_chunk, &chunk);
 | 
			
		||||
 | 
			
		||||
#ifndef DEBUG
 | 
			
		||||
	if (chunk.is_used == false)
 | 
			
		||||
	{
 | 
			
		||||
		write(2, "double free\n", 12);
 | 
			
		||||
		// THROW ERROR
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	// CALL THE RIGHT FREE FUNCTION DEPEND ON SIZE
 | 
			
		||||
	free_funcs[i](&chunk);	
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user