summaryrefslogtreecommitdiffstats
path: root/generic/tclListObj.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-29 09:23:24 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-29 09:23:24 (GMT)
commit65dc2244087c3473d889b21b73fa53fb552da528 (patch)
tree650271c04450eb0bb8ecb8967aeb9a7d13f62980 /generic/tclListObj.c
parent3179079214bd7ec9eecf26f71b91ea8d5c7308d1 (diff)
parentd967827b739973e53a0ca4e78ad873ee45949160 (diff)
downloadtcl-65dc2244087c3473d889b21b73fa53fb552da528.zip
tcl-65dc2244087c3473d889b21b73fa53fb552da528.tar.gz
tcl-65dc2244087c3473d889b21b73fa53fb552da528.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/tclListObj.c')
-rw-r--r--generic/tclListObj.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 53c3f66..2d1defa 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -967,6 +967,14 @@ Tcl_ListObjReplace(
if (listRepPtr == NULL) {
listRepPtr = AttemptNewList(interp, numRequired, 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;
}
}