diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-06-24 20:27:19 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-06-24 20:27:19 (GMT) |
commit | 6264f4978838b089748579e436d35b30a4e56201 (patch) | |
tree | c4a09f09a5dd9f7c2ac319f5f1ec231f7cc66353 /generic/tclEnv.c | |
parent | 9d19f3532ce6a01e00e85a877145088683cde4f4 (diff) | |
parent | 94f9cf81ed3e156bd372a3cac249974d1acb4e1d (diff) | |
download | tcl-6264f4978838b089748579e436d35b30a4e56201.zip tcl-6264f4978838b089748579e436d35b30a4e56201.tar.gz tcl-6264f4978838b089748579e436d35b30a4e56201.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic/tclEnv.c')
-rw-r--r-- | generic/tclEnv.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 8cc4b74..40ced17 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -723,14 +723,25 @@ TclFinalizeEnvironment(void) * strings. This may leak more memory that strictly necessary, since some * of the strings may no longer be in the environment. However, * determining which ones are ok to delete is n-squared, and is pretty - * unlikely, so we don't bother. + * unlikely, so we don't bother. However, in the case of DPURIFY, just + * free all strings in the cache. */ if (env.cache) { +#ifdef PURIFY + int i; + for (i = 0; i < env.cacheSize; i++) { + ckfree(env.cache[i]); + } +#endif ckfree(env.cache); env.cache = NULL; env.cacheSize = 0; #ifndef USE_PUTENV + if ((env.ourEnviron != NULL)) { + ckfree(env.ourEnviron); + env.ourEnviron = NULL; + } env.ourEnvironSize = 0; #endif } |