diff options
Diffstat (limited to 'tcl8.6/generic/tclEnv.c')
-rw-r--r-- | tcl8.6/generic/tclEnv.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tcl8.6/generic/tclEnv.c b/tcl8.6/generic/tclEnv.c index 8cc4b74..40ced17 100644 --- a/tcl8.6/generic/tclEnv.c +++ b/tcl8.6/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 } |