From a521fa4165537cf02262c1a4dff4f833cdce0905 Mon Sep 17 00:00:00 2001 From: axel Date: Mon, 6 Feb 2006 23:47:01 +1000 Subject: [PATCH] Make execution of functions use wcsdup to make sure no memory errors happen if a function removes itself darcs-hash:20060206134701-ac50b-27be7fe76512d6ac4313eea79b45a9c11083bccd.gz --- exec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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();