summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-07-15 17:50:20 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-07-15 17:50:20 (GMT)
commita5cd0c254693b12d78c39cc4cddc07745e121668 (patch)
tree8c97671615ef0ff14a25f3d36beda514f6319c5e
parent965e4bbab2201076c8c2bc6ae5baca705ab889b0 (diff)
downloadtcl-a5cd0c254693b12d78c39cc4cddc07745e121668.zip
tcl-a5cd0c254693b12d78c39cc4cddc07745e121668.tar.gz
tcl-a5cd0c254693b12d78c39cc4cddc07745e121668.tar.bz2
Avoid segfaults when RecordByteCodeStats() is called in a deleted interp.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclCompile.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a31c51..b5b1894 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-15 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclCompile.c: Avoid segfaults when RecordByteCodeStats()
+ is called in a deleted interp.
+
2011-07-13 Don Porter <dgp@users.sourceforge.net>
* generic/tclProc.c: [Bug 3366265] Buffer for storing the command
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index f29c54e..e281a0a 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -4012,6 +4012,11 @@ RecordByteCodeStats(codePtr)
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;