summaryrefslogtreecommitdiff
path: root/Src/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c4
1 files changed, 3 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);
}