diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclCompile.c | 2 | ||||
-rw-r--r-- | generic/tclLiteral.c | 9 |
2 files changed, 8 insertions, 3 deletions
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); } } |