25 lines
		
	
	
		
			412 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			412 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
 | 
						|
global HEAP_SIZE = 0x0030;
 | 
						|
main()
 | 
						|
{
 | 
						|
	local ptr1;
 | 
						|
	local ptr2;
 | 
						|
	name = "galloc";
 | 
						|
	
 | 
						|
	ptr1 = galloc(1);
 | 
						|
	test_num(ptr1, heap + LOCATION_DATA, "");
 | 
						|
	free(ptr1);	
 | 
						|
 | 
						|
	ptr1 = galloc(1);
 | 
						|
	test_num(ptr1, heap + LOCATION_DATA, "alloc after free");
 | 
						|
	free(ptr1);
 | 
						|
 | 
						|
	ptr2 = galloc(0x9000);
 | 
						|
	test_num(ptr2, 0, "alloc too big");
 | 
						|
 | 
						|
	test_num(leaks(), 0, "leaks");
 | 
						|
	ptr1 = galloc(1);
 | 
						|
	test_num(leaks(), 1, "leaks");
 | 
						|
	free(ptr1);
 | 
						|
}
 |