mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Use scoped_push to save and restore real_io
Fixes a dangling pointer
This commit is contained in:
parent
906d235601
commit
d1feb9bcbf
1 changed files with 2 additions and 1 deletions
|
@ -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 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;
|
int (*cmd)(parser_t &parser, const wchar_t * const *argv)=0;
|
||||||
real_io = &io;
|
|
||||||
|
scoped_push<const io_chain_t*> set_real_io(&real_io, &io);
|
||||||
|
|
||||||
CHECK(argv, STATUS_BUILTIN_ERROR);
|
CHECK(argv, STATUS_BUILTIN_ERROR);
|
||||||
CHECK(argv[0], STATUS_BUILTIN_ERROR);
|
CHECK(argv[0], STATUS_BUILTIN_ERROR);
|
||||||
|
|
Loading…
Reference in a new issue