Bug fix in call to realloc when realloc'ing the stack