mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Make execution of functions use wcsdup to make sure no memory errors happen if a function removes itself
darcs-hash:20060206134701-ac50b-27be7fe76512d6ac4313eea79b45a9c11083bccd.gz
This commit is contained in:
parent
0f76f77173
commit
a521fa4165
1 changed files with 3 additions and 1 deletions
4
exec.c
4
exec.c
|
@ -791,7 +791,7 @@ void exec( job_t *j )
|
||||||
int i;
|
int i;
|
||||||
string_buffer_t sb;
|
string_buffer_t sb;
|
||||||
|
|
||||||
const wchar_t * def = function_get_definition( p->argv[0] );
|
const wchar_t * def = wcsdup(function_get_definition( p->argv[0] ));
|
||||||
//fwprintf( stderr, L"run function %ls\n", argv[0] );
|
//fwprintf( stderr, L"run function %ls\n", argv[0] );
|
||||||
if( def == 0 )
|
if( def == 0 )
|
||||||
{
|
{
|
||||||
|
@ -834,6 +834,8 @@ void exec( job_t *j )
|
||||||
|
|
||||||
internal_exec_helper( def, TOP, j->io );
|
internal_exec_helper( def, TOP, j->io );
|
||||||
|
|
||||||
|
free( def );
|
||||||
|
|
||||||
parser_allow_function();
|
parser_allow_function();
|
||||||
parser_pop_block();
|
parser_pop_block();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue