2023-06-18 09:16:58 -04:00
|
|
|
|
|
|
|
global HEAP_SIZE = 0x0030;
|
2023-06-14 11:51:21 -04:00
|
|
|
main()
|
|
|
|
{
|
2023-06-18 05:11:23 -04:00
|
|
|
local ptr1;
|
|
|
|
local ptr2;
|
2023-06-14 11:51:21 -04:00
|
|
|
name = "galloc";
|
2023-06-18 05:11:23 -04:00
|
|
|
|
|
|
|
ptr1 = galloc(1);
|
2023-06-18 14:03:27 -04:00
|
|
|
test_num(ptr1, heap + LOCATION_DATA, "");
|
2023-06-18 05:11:23 -04:00
|
|
|
free(ptr1);
|
2023-06-18 09:16:58 -04:00
|
|
|
|
2023-06-18 05:11:23 -04:00
|
|
|
ptr1 = galloc(1);
|
2023-06-18 14:03:27 -04:00
|
|
|
test_num(ptr1, heap + LOCATION_DATA, "alloc after free");
|
2023-06-18 09:16:58 -04:00
|
|
|
free(ptr1);
|
|
|
|
|
|
|
|
ptr2 = galloc(0x9000);
|
2023-06-18 14:03:27 -04:00
|
|
|
test_num(ptr2, 0, "alloc too big");
|
2023-07-23 09:35:16 -04:00
|
|
|
|
2023-07-23 13:38:40 -04:00
|
|
|
test_num(leaks(), 0, "leaks");
|
|
|
|
ptr1 = galloc(1);
|
2023-07-23 09:35:16 -04:00
|
|
|
test_num(leaks(), 1, "leaks");
|
2023-07-23 13:38:40 -04:00
|
|
|
free(ptr1);
|
2023-06-14 11:51:21 -04:00
|
|
|
}
|