summaryrefslogtreecommitdiffstats
path: root/generic/tclEnv.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-10-17 19:47:01 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-10-17 19:47:01 (GMT)
commit1b03667a27e4f198e48c344454663aae4c085a14 (patch)
tree70bbdddb4f6bdec0c26dd22cf8ccd499b1c97416 /generic/tclEnv.c
parent5c24bebd2b402df644549d6c0efe6586dde65891 (diff)
parente154c5151281fbbe01ef1361f5f6980a5ec5a6d3 (diff)
downloadtcl-1b03667a27e4f198e48c344454663aae4c085a14.zip
tcl-1b03667a27e4f198e48c344454663aae4c085a14.tar.gz
tcl-1b03667a27e4f198e48c344454663aae4c085a14.tar.bz2
merge 8.7
Diffstat (limited to 'generic/tclEnv.c')
-rw-r--r--generic/tclEnv.c13
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
}