summaryrefslogtreecommitdiffstats
path: root/generic/tclEnv.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2018-09-28 09:18:49 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2018-09-28 09:18:49 (GMT)
commit9dabbdf40b10e3f0419d5ad5b96f4d7c3189bc6a (patch)
tree233faf46a3a4bde6f5a4c5ad45db18d7e7cdd69e /generic/tclEnv.c
parent0d36d5f3d85b79ed2c3565112c78bbd18d1a7990 (diff)
parent2f3fc1cfa29f6a4dac413ac62258bfb235feb257 (diff)
downloadtcl-9dabbdf40b10e3f0419d5ad5b96f4d7c3189bc6a.zip
tcl-9dabbdf40b10e3f0419d5ad5b96f4d7c3189bc6a.tar.gz
tcl-9dabbdf40b10e3f0419d5ad5b96f4d7c3189bc6a.tar.bz2
merge core-8-branch
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
}