diff --git a/exec.c b/exec.c index a77baded2..d1abe5909 100644 --- a/exec.c +++ b/exec.c @@ -791,7 +791,7 @@ void exec( job_t *j ) int i; 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] ); if( def == 0 ) { @@ -834,6 +834,8 @@ void exec( job_t *j ) internal_exec_helper( def, TOP, j->io ); + free( def ); + parser_allow_function(); parser_pop_block();