The stack grew too large and hit the guard page at 0x7fffff000000.
Every recursive call pushed a new frame. With no base case to stop it, the stack ran out of space —
a classic stack overflow.
Undefined Behaviour!
Writing to *ptr after free(ptr)
is a use-after-free bug. The memory has been returned to the allocator —
it might belong to something else now. The result is undefined: crash, silent corruption, or a security hole.