aboutsummaryrefslogtreecommitdiffhomepage
path: root/exec.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-02-06 23:47:01 +1000
committerGravatar axel <axel@liljencrantz.se>2006-02-06 23:47:01 +1000
commita521fa4165537cf02262c1a4dff4f833cdce0905 (patch)
tree9efebb3e1cf97837f674c7bba64b9dfca726d9e8 /exec.c
parent0f76f7717391a64aa3c923fe4c74411e4d40bab4 (diff)
Make execution of functions use wcsdup to make sure no memory errors happen if a function removes itself
darcs-hash:20060206134701-ac50b-27be7fe76512d6ac4313eea79b45a9c11083bccd.gz
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/exec.c b/exec.c
index a77baded..d1abe590 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();