diff options
author | griffin <briang42@easystreet.net> | 2023-05-23 21:36:46 (GMT) |
---|---|---|
committer | griffin <briang42@easystreet.net> | 2023-05-23 21:36:46 (GMT) |
commit | e91f967003cb7c4aa4512e9afc4bf5199e48ba92 (patch) | |
tree | 90757e0d4dc74d64240ebf00ddaa08f36f1a4854 /generic/tclEnsemble.c | |
parent | fa313109d6a46e437c1583c859b6e79e0a6dae2a (diff) | |
parent | 54a1d7e517922684d8612dea07b479a6d493e2f1 (diff) | |
download | tcl-e91f967003cb7c4aa4512e9afc4bf5199e48ba92.zip tcl-e91f967003cb7c4aa4512e9afc4bf5199e48ba92.tar.gz tcl-e91f967003cb7c4aa4512e9afc4bf5199e48ba92.tar.bz2 |
Merge trunk
Diffstat (limited to 'generic/tclEnsemble.c')
-rw-r--r-- | generic/tclEnsemble.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 02f8672..c238141 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -312,7 +312,17 @@ TclNamespaceEnsembleCmd( Tcl_AppendObjToObj(newCmd, listv[0]); Tcl_ListObjReplace(NULL, newList, 0, 1, 1, &newCmd); if (patchedDict == NULL) { - patchedDict = Tcl_DuplicateObj(objv[1]); + patchedDict = TclDuplicatePureObj( + interp, objv[1], &tclDictType); + if (!patchedDict) { + if (allocatedMapFlag) { + Tcl_DecrRefCount(mapObj); + } + Tcl_DecrRefCount(newList); + Tcl_DecrRefCount(newCmd); + Tcl_DecrRefCount(patchedDict); + return TCL_ERROR; + } } Tcl_DictObjPut(NULL, patchedDict, subcmdWordsObj, newList); @@ -596,7 +606,14 @@ TclNamespaceEnsembleCmd( } cmd = TclGetString(listv[0]); if (!(cmd[0] == ':' && cmd[1] == ':')) { - Tcl_Obj *newList = Tcl_DuplicateObj(listObj); + Tcl_Obj *newList = TclDuplicatePureObj( + interp, listObj, &tclListType); + if (!newList) { + if (patchedDict) { + Tcl_DecrRefCount(patchedDict); + } + goto freeMapAndError; + } Tcl_Obj *newCmd = NewNsObj((Tcl_Namespace*)nsPtr); if (nsPtr->parentPtr) { @@ -606,7 +623,11 @@ TclNamespaceEnsembleCmd( Tcl_ListObjReplace(NULL, newList, 0, 1, 1, &newCmd); if (patchedDict == NULL) { - patchedDict = Tcl_DuplicateObj(objv[1]); + patchedDict = TclDuplicatePureObj( + interp, objv[1], &tclListType); + if (!patchedDict) { + goto freeMapAndError; + } } Tcl_DictObjPut(NULL, patchedDict, subcmdWordsObj, newList); @@ -1904,7 +1925,11 @@ NsEnsembleImplementationCmdNR( TclListObjLengthM(NULL, prefixObj, &prefixObjc); if (objc == 2) { - copyPtr = TclDuplicatePureObj(prefixObj); + copyPtr = TclDuplicatePureObj( + interp, prefixObj, &tclListType); + if (!copyPtr) { + return TCL_ERROR; + } } else { copyPtr = Tcl_NewListObj(objc - 2 + prefixObjc, NULL); Tcl_ListObjAppendList(NULL, copyPtr, prefixObj); @@ -2304,7 +2329,11 @@ EnsembleUnknownCallback( * Create the "unknown" command callback to determine what to do. */ - unknownCmd = Tcl_DuplicateObj(ensemblePtr->unknownHandler); + unknownCmd = TclDuplicatePureObj( + interp, ensemblePtr->unknownHandler, &tclListType); + if (!unknownCmd) { + return TCL_ERROR; + } TclNewObj(ensObj); Tcl_GetCommandFullName(interp, ensemblePtr->token, ensObj); Tcl_ListObjAppendElement(NULL, unknownCmd, ensObj); |