This project is about creating a stack on the heap based on the attributes of GCC, cleanup, constructor, destructor. This stack is used to automatically wipe memory allocated on the heap.
You need to link your library to your binary by running somthing like this:
$ gcc -L<library_location> <CFLAGS> [...] -lheap-stack
int main(void)
{
stack_scope;
int *array = stack_malloc(10 * sizeof(int));
/* Any other thing you need to do */
return 0;
} /* array is freed */
This compile test bin example and the shared library.
$ make all
$ make heap-stack.so
$ make heap_stack
$ make debug <target>
$ make asan <target>