summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-29 09:16:43 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-29 09:16:43 (GMT)
commitd967827b739973e53a0ca4e78ad873ee45949160 (patch)
treed39e09a819b1d12d98bc6bf4dbf3f72ccac830ae /generic
parent74ba8ceda7f5765eb6d06f6bac99f565b9a71154 (diff)
parent7523143f3e7c3a026b3addb99bfeb70dd9adaff5 (diff)
downloadtcl-d967827b739973e53a0ca4e78ad873ee45949160.zip
tcl-d967827b739973e53a0ca4e78ad873ee45949160.tar.gz
tcl-d967827b739973e53a0ca4e78ad873ee45949160.tar.bz2
restore refcounts as they were before the Tcl_ListObjReplace call, in the error situation.
In Tcl9, make this a true Tcl_DecrRefCount, which properly cleans objects with refCount 0
Diffstat (limited to 'generic')
-rw-r--r--generic/tclListObj.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 1166759..20b6ec1 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -906,6 +906,14 @@ Tcl_ListObjReplace(
listRepPtr = AttemptNewList(interp, newMax, NULL);
if (listRepPtr == NULL) {
+ for (i = 0; i < objc; i++) {
+ /* See bug 3598580 */
+#if TCL_MAJOR_VERSION > 8
+ Tcl_DecrRefCount(objv[i]);
+#else
+ objv[i]->refCount--;
+#endif
+ }
return TCL_ERROR;
}