diff options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/builtin.c | 4 | ||||
-rw-r--r-- | Src/exec.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index 78d67ca8e..b986dd89a 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -3275,8 +3275,10 @@ bin_functions(char *name, char **argv, Options ops, int func) shf = (Shfunc) zshcalloc(sizeof *shf); shfunctab->addnode(shfunctab, ztrdup(funcname), shf); } - if (*argv) + if (*argv) { + zsfree(shf->filename); shf->filename = ztrdup(*argv); + } shf->node.flags = on; ret = eval_autoload(shf, funcname, ops, func); } diff --git a/Src/exec.c b/Src/exec.c index a41d05b41..7bec7ce48 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -5204,6 +5204,7 @@ loadautofn(Shfunc shf, int fksh, int autol, int current_fpath) else shf->funcdef = dupeprog(prog, 0); shf->node.flags &= ~PM_UNDEFINED; + zsfree(shf->filename); shf->filename = fname; } else { VARARR(char, n, strlen(shf->node.nam) + 1); @@ -5227,6 +5228,7 @@ loadautofn(Shfunc shf, int fksh, int autol, int current_fpath) else shf->funcdef = dupeprog(stripkshdef(prog, shf->node.nam), 0); shf->node.flags &= ~PM_UNDEFINED; + zsfree(shf->filename); shf->filename = fname; } popheap(); |