summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-03-07 21:16:29 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-03-07 21:16:29 (GMT)
commit01a81e3c75a12eacf36e83cd3cc53fb4eb554e2a (patch)
tree62e627eb073d351a3c0eed19b97949a290f864ff
parent121e90a73db69eff2a2c317545416c7a0308d8eb (diff)
downloadtcl-01a81e3c75a12eacf36e83cd3cc53fb4eb554e2a.zip
tcl-01a81e3c75a12eacf36e83cd3cc53fb4eb554e2a.tar.gz
tcl-01a81e3c75a12eacf36e83cd3cc53fb4eb554e2a.tar.bz2
Correct unbalanced effect of TclInvalidateCmdLiteral() on the refcountsbug_3607246
of literals in the global table.
-rw-r--r--generic/tclLiteral.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c
index e2ee9b4..e2ee361 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);
}
}