Fix memory deallocation in stack.c.