summaryrefslogtreecommitdiffstats
path: root/generic
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)
commit94c90bd10e4e6d1c7f48de600f32cee2735b7d58 (patch)
tree8c97671615ef0ff14a25f3d36beda514f6319c5e /generic
parente52188bb947ad440f55db9df3820f490d62dda97 (diff)
downloadtcl-94c90bd10e4e6d1c7f48de600f32cee2735b7d58.zip
tcl-94c90bd10e4e6d1c7f48de600f32cee2735b7d58.tar.gz
tcl-94c90bd10e4e6d1c7f48de600f32cee2735b7d58.tar.bz2
Avoid segfaults when RecordByteCodeStats() is called in a deleted interp.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompile.c5
1 files changed, 5 insertions, 0 deletions
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;