diff options
| author | Peter Stephenson <pws@zsh.org> | 2017-01-11 12:11:22 +0000 |
|---|---|---|
| committer | Peter Stephenson <pws@zsh.org> | 2017-01-11 12:11:22 +0000 |
| commit | 47b7f2adef9d7e399af9d06a67b4db1ad55d4f32 (patch) | |
| tree | 62956db751e1bfe226bae4d5b14c075ca8871c4d /Src/exec.c | |
| parent | Add features associated with autoloading a function using an absolute (diff) | |
| download | zsh-47b7f2adef9d7e399af9d06a67b4db1ad55d4f32.tar zsh-47b7f2adef9d7e399af9d06a67b4db1ad55d4f32.tar.gz zsh-47b7f2adef9d7e399af9d06a67b4db1ad55d4f32.tar.bz2 zsh-47b7f2adef9d7e399af9d06a67b4db1ad55d4f32.tar.lz zsh-47b7f2adef9d7e399af9d06a67b4db1ad55d4f32.tar.xz zsh-47b7f2adef9d7e399af9d06a67b4db1ad55d4f32.tar.zst zsh-47b7f2adef9d7e399af9d06a67b4db1ad55d4f32.zip | |
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.
Diffstat (limited to 'Src/exec.c')
| -rw-r--r-- | Src/exec.c | 2 |
1 files changed, 2 insertions, 0 deletions
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(); |
