diff options
author | dgp <dgp@users.sourceforge.net> | 2016-07-08 14:19:23 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2016-07-08 14:19:23 (GMT) |
commit | 8c040ee77b5cc022530f195ad1401b0a6762f931 (patch) | |
tree | f6c7955433181cc296261721c3c51eca88bb12ae | |
parent | 6e64f64efb7bf46602985c83e4ec87bfdefc8289 (diff) | |
parent | 1d9f88074f824a962f99296d5aefece2fa918a99 (diff) | |
download | tcl-8c040ee77b5cc022530f195ad1401b0a6762f931.zip tcl-8c040ee77b5cc022530f195ad1401b0a6762f931.tar.gz tcl-8c040ee77b5cc022530f195ad1401b0a6762f931.tar.bz2 |
Repair some memory corruption problems in EnsembleCmdRep.
-rw-r--r-- | generic/tclEnsemble.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index ee81aee..8e5e410 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -95,7 +95,7 @@ typedef struct { int epoch; /* Used to confirm when the data in this * really structure matches up with the * ensemble. */ - Tcl_Command token; /* Reference to the comamnd for which this + Command *token; /* Reference to the command for which this * structure is a cache of the resolution. */ Tcl_Obj *fix; /* Corrected spelling, if needed. */ Tcl_HashEntry *hPtr; /* Direct link to entry in the subcommand @@ -1722,7 +1722,7 @@ NsEnsembleImplementationCmdNR( EnsembleCmdRep *ensembleCmd = subObj->internalRep.twoPtrValue.ptr1; if (ensembleCmd->epoch == ensemblePtr->epoch && - ensembleCmd->token == ensemblePtr->token) { + ensembleCmd->token == (Command *)ensemblePtr->token) { prefixObj = Tcl_GetHashValue(ensembleCmd->hPtr); Tcl_IncrRefCount(prefixObj); if (ensembleCmd->fix) { @@ -2348,6 +2348,7 @@ MakeCachedEnsembleCommand( if (objPtr->typePtr == &ensembleCmdType) { ensembleCmd = objPtr->internalRep.twoPtrValue.ptr1; + TclCleanupCommandMacro(ensembleCmd->token); if (ensembleCmd->fix) { Tcl_DecrRefCount(ensembleCmd->fix); } @@ -2368,7 +2369,8 @@ MakeCachedEnsembleCommand( */ ensembleCmd->epoch = ensemblePtr->epoch; - ensembleCmd->token = ensemblePtr->token; + ensembleCmd->token = (Command *) ensemblePtr->token; + ensembleCmd->token->refCount++; if (fix) { Tcl_IncrRefCount(fix); } @@ -2754,6 +2756,7 @@ FreeEnsembleCmdRep( { EnsembleCmdRep *ensembleCmd = objPtr->internalRep.twoPtrValue.ptr1; + TclCleanupCommandMacro(ensembleCmd->token); if (ensembleCmd->fix) { Tcl_DecrRefCount(ensembleCmd->fix); } @@ -2791,6 +2794,7 @@ DupEnsembleCmdRep( copyPtr->internalRep.twoPtrValue.ptr1 = ensembleCopy; ensembleCopy->epoch = ensembleCmd->epoch; ensembleCopy->token = ensembleCmd->token; + ensembleCopy->token->refCount++; ensembleCopy->fix = ensembleCmd->fix; if (ensembleCopy->fix) { Tcl_IncrRefCount(ensembleCopy->fix); |