summaryrefslogtreecommitdiffstats
path: root/generic/tclEnv.c
diff options
context:
space:
mode:
authorkjnash <k.j.nash@usa.net>2018-09-15 18:41:23 (GMT)
committerkjnash <k.j.nash@usa.net>2018-09-15 18:41:23 (GMT)
commitd24a3eb2babc2868c7935f0815288c9ab02c3880 (patch)
tree2ee6809fdc6448db53cbd12bb6e35df4fe077503 /generic/tclEnv.c
parent754bb107b4100f394d445d589dddc94e59dd2d04 (diff)
parent9a15a1b58648809ffb208eaa00cd20af4784050d (diff)
downloadtcl-d24a3eb2babc2868c7935f0815288c9ab02c3880.zip
tcl-d24a3eb2babc2868c7935f0815288c9ab02c3880.tar.gz
tcl-d24a3eb2babc2868c7935f0815288c9ab02c3880.tar.bz2
merge 8.6
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
}