summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c8
-rw-r--r--generic/tclCompile.c36
2 files changed, 28 insertions, 16 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index c91fdc1..4ce4590 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.75.2.32 2008/07/23 20:45:16 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.75.2.33 2008/07/28 20:01:07 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -1202,6 +1202,10 @@ DeleteInterpProc(interp)
ckfree ((char*) eclPtr->loc);
}
+ if (eclPtr->eiloc != NULL) {
+ ckfree ((char*) eclPtr->eiloc);
+ }
+
ckfree ((char*) eclPtr);
Tcl_DeleteHashEntry (hPtr);
}
@@ -3906,10 +3910,10 @@ EvalEx(interp, script, numBytes, flags, line)
return TCL_ERROR;
}
eeFrame.data.eval.path = norm;
- Tcl_IncrRefCount (eeFrame.data.eval.path);
} else {
eeFrame.data.eval.path = Tcl_NewStringObj ("",-1);
}
+ Tcl_IncrRefCount (eeFrame.data.eval.path);
} else {
/* Set up for plain eval */
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 59be33a..44ee69b 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompile.c,v 1.43.2.12 2008/07/23 20:45:18 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclCompile.c,v 1.43.2.13 2008/07/28 20:01:09 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -836,40 +836,48 @@ TclInitCompileEnv(interp, envPtr, string, numBytes, invoker, word)
* (line, path, ...). Which may make change the type as well.
*/
- if ((invoker->nline <= word) || (invoker->line[word] < 0)) {
+ CmdFrame ctx = *invoker;
+ int pc = 0;
+
+ if (invoker->type == TCL_LOCATION_BC) {
+ /* Note: Type BC => ctx.data.eval.path is not used.
+ * ctx.data.tebc.codePtr is used instead.
+ */
+ TclGetSrcInfoForPc (&ctx);
+ pc = 1;
+ }
+
+ if ((ctx.nline <= word) || (ctx.line[word] < 0)) {
/* Word is not a literal, relative counting */
envPtr->line = 1;
envPtr->extCmdMapPtr->type = (envPtr->procPtr
? TCL_LOCATION_PROC
: TCL_LOCATION_BC);
- } else {
- CmdFrame ctx = *invoker;
- int pc = 0;
- if (invoker->type == TCL_LOCATION_BC) {
- /* Note: Type BC => ctx.data.eval.path is not used.
- * ctx.data.tebc.codePtr is used instead.
+ if (pc && (ctx.type == TCL_LOCATION_SOURCE)) {
+ /*
+ * The reference made by 'TclGetSrcInfoForPc' is dead.
*/
- TclGetSrcInfoForPc (&ctx);
- pc = 1;
+ Tcl_DecrRefCount(ctx.data.eval.path);
}
-
+ } else {
envPtr->line = ctx.line [word];
envPtr->extCmdMapPtr->type = ctx.type;
+ envPtr->extCmdMapPtr->path = ctx.data.eval.path;
if (ctx.type == TCL_LOCATION_SOURCE) {
if (pc) {
/* The reference 'TclGetSrcInfoForPc' made is transfered */
- envPtr->extCmdMapPtr->path = ctx.data.eval.path;
ctx.data.eval.path = NULL;
} else {
/* We have a new reference here */
- envPtr->extCmdMapPtr->path = ctx.data.eval.path;
- Tcl_IncrRefCount (envPtr->extCmdMapPtr->path);
+ Tcl_IncrRefCount (ctx.data.eval.path);
}
}
}
+
+ /* ctx going out of scope */
}
#endif