From 6df0a0efa540b67adb5a9d1bb2c5f58f8f656e23 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 17 Feb 2012 15:14:16 +0000 Subject: bug fix: avoid segfaulting by deleted interp in RecordByteCodeStats --- generic/tclCompile.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 6d64feb..59d1fbf 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -4091,12 +4091,11 @@ RecordByteCodeStats( * to add to accumulated statistics. */ { 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; } + register ByteCodeStats *statsPtr = &(iPtr->stats); statsPtr->numCompilations++; statsPtr->totalSrcBytes += (double) codePtr->numSrcBytes; -- cgit v0.12 From 76adf66e550eb63f49a19c9ada4e49123efea2ec Mon Sep 17 00:00:00 2001 From: andreask Date: Fri, 17 Feb 2012 17:12:32 +0000 Subject: Fix: Removed C99ism (in-block variable declaration) from commit [39f6ebe301] which prevents building with non-gcc compilers, notably AIX, HPUX, Solaris, MSVC6, possibly others. --- generic/tclCompile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/tclCompile.c b/generic/tclCompile.c index 59d1fbf..9b23389 100644 --- a/generic/tclCompile.c +++ b/generic/tclCompile.c @@ -4091,11 +4091,13 @@ RecordByteCodeStats( * to add to accumulated statistics. */ { Interp *iPtr = (Interp *) *codePtr->interpHandle; + register ByteCodeStats *statsPtr; + if (iPtr == NULL) { /* Avoid segfaulting in case we're called in a deleted interp */ return; } - register ByteCodeStats *statsPtr = &(iPtr->stats); + statsPtr = &(iPtr->stats); statsPtr->numCompilations++; statsPtr->totalSrcBytes += (double) codePtr->numSrcBytes; -- cgit v0.12