summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-03-11 12:55:29 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-03-11 12:55:29 (GMT)
commitdf4d161b0f8447292465330d03550426006fd13c (patch)
treec0d4f0ded6d161132b16a0b6ec9e31db28a0b8a9
parenta1f9566f74e6769c201e4040540880eb58e0767c (diff)
parent53d74314391e46506521ca790914b8610611c095 (diff)
downloadtcl-df4d161b0f8447292465330d03550426006fd13c.zip
tcl-df4d161b0f8447292465330d03550426006fd13c.tar.gz
tcl-df4d161b0f8447292465330d03550426006fd13c.tar.bz2
3607246,3607372 Unbalanced refcounts of literals in the global literal table.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclCompile.c2
-rw-r--r--generic/tclLiteral.c9
3 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 88e698f..ebe9cc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-11 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclCompile.c: [Bugs 3607246,3607372] Unbalanced refcounts
+ * generic/tclLiteral.c: of literals in the global literal table.
+
2013-03-06 Don Porter <dgp@users.sourceforge.net>
* generic/regc_nfa.c: [Bugs 3604074,3606683] Rewrite of the
diff --git a/generic/tclCompile.c b/generic/tclCompile.c
index 5427759..0e98385 100644
--- a/generic/tclCompile.c
+++ b/generic/tclCompile.c
@@ -2596,7 +2596,7 @@ TclInitByteCodeObj(
codePtr->objArrayPtr[i] = Tcl_NewStringObj(bytes, numBytes);
Tcl_IncrRefCount(codePtr->objArrayPtr[i]);
- Tcl_DecrRefCount(objPtr);
+ TclReleaseLiteral((Tcl_Interp *)iPtr, objPtr);
} else {
codePtr->objArrayPtr[i] = fetched;
}
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c
index ce258cf..11da6f8 100644
--- a/generic/tclLiteral.c
+++ b/generic/tclLiteral.c
@@ -1010,8 +1010,13 @@ TclInvalidateCmdLiteral(
Tcl_Obj *literalObjPtr = TclCreateLiteral(iPtr, (char *) name,
strlen(name), -1, NULL, nsPtr, 0, NULL);
- if (literalObjPtr != NULL && literalObjPtr->typePtr == &tclCmdNameType) {
- TclFreeIntRep(literalObjPtr);
+ if (literalObjPtr != NULL) {
+ if (literalObjPtr->typePtr == &tclCmdNameType) {
+ TclFreeIntRep(literalObjPtr);
+ }
+ /* Balance the refcount effects of TclCreateLiteral() above */
+ Tcl_IncrRefCount(literalObjPtr);
+ TclReleaseLiteral(interp, literalObjPtr);
}
}