summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-07-15 17:56:06 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-07-15 17:56:06 (GMT)
commit740e87bc587f376b103ac0e7c9327b136f6d95e5 (patch)
treec42b201c8a8628a1db61a8fd97a3a30ab418c479
parent1130e315a1f08f8e5fc097300382f7fac38b0896 (diff)
parent1740ef8b435c39a49f9dcf65a14fee0ed3e553d9 (diff)
downloadtcl-740e87bc587f376b103ac0e7c9327b136f6d95e5.zip
tcl-740e87bc587f376b103ac0e7c9327b136f6d95e5.tar.gz
tcl-740e87bc587f376b103ac0e7c9327b136f6d95e5.tar.bz2
Avoid segfaults when RecordByteCodeStats() is called in a deleted interp.
-rw-r--r--ChangeLog3
-rw-r--r--generic/tclCompile.c5
2 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 80ca332..f9dbc26 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2011-07-15 Don Porter <dgp@users.sourceforge.net>
+ * generic/tclCompile.c: Avoid segfaults when RecordByteCodeStats()
+ is called in a deleted interp.
+
* generic/tclCompile.c: [Bug 467523, 3357771] Prevent circular
references in values with ByteCode intreps. They can lead to
memory leaks.
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 8aedf95..ae633ea 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -4572,6 +4572,11 @@ RecordByteCodeStats(
Interp *iPtr = (Interp *) *codePtr->interpHandle;
register ByteCodeStats *statsPtr = &iPtr->stats;
+ if (iPtr == NULL) {
+ /* Avoid segfaulting in case we're called in a deleted interp */
+ return;
+ }
+
statsPtr->numCompilations++;
statsPtr->totalSrcBytes += (double) codePtr->numSrcBytes;
statsPtr->totalByteCodeBytes += (double) codePtr->structureSize;