diff options
author | dgp <dgp@noemail.net> | 2011-07-15 17:56:06 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2011-07-15 17:56:06 (GMT) |
commit | 1e455b03a18f7d39edd4ba5be2561a755b964ec3 (patch) | |
tree | c42b201c8a8628a1db61a8fd97a3a30ab418c479 | |
parent | 481a4a7785e306d6efeccf773aa8b8a008898557 (diff) | |
parent | d48f94a81629b31db9d58bac1517516779d233c6 (diff) | |
download | tcl-1e455b03a18f7d39edd4ba5be2561a755b964ec3.zip tcl-1e455b03a18f7d39edd4ba5be2561a755b964ec3.tar.gz tcl-1e455b03a18f7d39edd4ba5be2561a755b964ec3.tar.bz2 |
Avoid segfaults when RecordByteCodeStats() is called in a deleted interp.
FossilOrigin-Name: 609c597cb27644037338413ad1b813cf7b5a25eb
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | generic/tclCompile.c | 5 |
2 files changed, 8 insertions, 0 deletions
@@ -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; |