diff options
Diffstat (limited to 'Src/exec.c')
-rw-r--r-- | Src/exec.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Src/exec.c b/Src/exec.c index b86e5350c..ed7c08759 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -4431,10 +4431,12 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval) mod_export void runshfunc(Eprog prog, FuncWrap wrap, char *name) { - int cont; - VARARR(char, ou, underscoreused); + int cont, ouu; + char *ou; - memcpy(ou, underscore, underscoreused); + ou = zalloc(ouu = underscoreused); + if (ou) + memcpy(ou, underscore, underscoreused); while (wrap) { wrap->module->wrapper++; @@ -4445,13 +4447,19 @@ runshfunc(Eprog prog, FuncWrap wrap, char *name) (wrap->module->node.flags & MOD_UNLOAD)) unload_module(wrap->module); - if (!cont) + if (!cont) { + if (ou) + zfree(ou, ouu); return; + } wrap = wrap->next; } startparamscope(); execode(prog, 1, 0); - setunderscore(ou); + if (ou) { + setunderscore(ou); + zfree(ou, ouu); + } endparamscope(); } |