From d1feb9bcbf141e2195f37a8ab0f526c24a533cda Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 7 Jan 2015 16:41:16 -0800 Subject: [PATCH] Use scoped_push to save and restore real_io Fixes a dangling pointer --- builtin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin.cpp b/builtin.cpp index 630c04289..597f51c5b 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -4166,7 +4166,8 @@ static int internal_help(const wchar_t *cmd) int builtin_run(parser_t &parser, const wchar_t * const *argv, const io_chain_t &io) { int (*cmd)(parser_t &parser, const wchar_t * const *argv)=0; - real_io = &io; + + scoped_push set_real_io(&real_io, &io); CHECK(argv, STATUS_BUILTIN_ERROR); CHECK(argv[0], STATUS_BUILTIN_ERROR);