From 47b7f2adef9d7e399af9d06a67b4db1ad55d4f32 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 11 Jan 2017 12:11:22 +0000 Subject: unposted: more care with shell function filename. When updating shfunc structure to change filename we should be careful to free whatever's there already, we may now be the directory in which to find the function definition. After loading the field contains the full name of the file. --- Src/builtin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Src/builtin.c') 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); } -- cgit v1.2.3