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:
axel 2006-02-06 23:47:01 +10:00
parent 0f76f77173
commit a521fa4165

4
exec.c
View file

@ -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();