Memory leak: when `realloc` fails, the original `self.stack_` is not freed.