diff options
author | dgp <dgp@users.sourceforge.net> | 2013-03-07 21:16:29 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-03-07 21:16:29 (GMT) |
commit | 01a81e3c75a12eacf36e83cd3cc53fb4eb554e2a (patch) | |
tree | 62e627eb073d351a3c0eed19b97949a290f864ff /generic/tclLiteral.c | |
parent | 121e90a73db69eff2a2c317545416c7a0308d8eb (diff) | |
download | tcl-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.
Diffstat (limited to 'generic/tclLiteral.c')
-rw-r--r-- | generic/tclLiteral.c | 9 |
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); } } |