diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2009-05-11 09:03:25 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2009-05-11 09:03:25 +0000 |
commit | c18b6c2c99b14301ac005e27a9472feed9a46eec (patch) | |
tree | 08bdc0ce4179b70611b524042fb66a6a177d0e6f | |
parent | cfd3eab3d6b4bb31c258618909f302cc672b751e (diff) | |
download | zsh-c18b6c2c99b14301ac005e27a9472feed9a46eec.tar.gz zsh-c18b6c2c99b14301ac005e27a9472feed9a46eec.tar.xz zsh-c18b6c2c99b14301ac005e27a9472feed9a46eec.zip |
26956: tidy up some zle variables for module unloading
note issue found on HP-UX
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | Etc/zsh-development-guide | 4 | ||||
-rw-r--r-- | Src/Zle/zle_refresh.c | 4 |
3 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 0e7de4b7d..ce504f044 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-05-11 Peter Stephenson <pws@csr.com> + + * 26956: Etc/zsh-development-guide, Src/Zle/zle_refresh: + clear up region highlight variables properly and note that the + variables should be zeroed even if the module is being unloaded + (problem on HP-UX). + 2009-05-09 Andrey Borzenkov <bor@zsh.org> * unposted: Completion/Unix/Command/_getfacl: @@ -11684,5 +11691,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.4682 $ +* $Revision: 1.4683 $ ***************************************************** diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide index b19f4825a..fcbc3eab6 100644 --- a/Etc/zsh-development-guide +++ b/Etc/zsh-development-guide @@ -279,6 +279,10 @@ However, `finish_' is called even if `setup_' failed, so it should not rely on the module successfully being set up. The state from `finish_' module is currently ignored; it is called too late to prevent the module from being unloaded. +*Note* in addition to freeing memory, variables associated with allocated +memory should be set to NULL or to indicate arrays are empty, etc. It +should not be assumed that the variables will automatically be zeroed if +the module is reloaded (though some configurations may do this). In short, the `cleanup_'-function should undo what the `boot_'-function did (together with handling any residual effects of `enables_'), but should diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index cfcfed3da..c61abb48f 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -2644,6 +2644,10 @@ zle_refresh_finish(void) freevideo(); if (region_highlights) + { zfree(region_highlights, sizeof(struct region_highlight) * n_region_highlights); + region_highlights = NULL; + n_region_highlights = 0; + } } |