Just referencing this article:
https://www.tutorialspoint.com/c_standard_library/c_function_free.htm
"The C library function void free(void *ptr) deallocates the memory previously allocated by a call to calloc, malloc, or realloc."
So because a
is a stack allocated variable rather than a block of memory allocated by one of the *alloc
functions the free
function may not affect it at all (i.e. it's undefined behaviour).