summaryrefslogtreecommitdiffstats
path: root/generic/tclListObj.c
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)
commit53eb119d0b2711c0dc9ec4bdad28ae9c185ca7e4 (patch)
treed39e09a819b1d12d98bc6bf4dbf3f72ccac830ae /generic/tclListObj.c
parent78d91cb25398a571e59790e8ba63206f8a6372ea (diff)
parent8751239349e355c4983ba5b7fe1696515ab41711 (diff)
downloadtcl-53eb119d0b2711c0dc9ec4bdad28ae9c185ca7e4.zip
tcl-53eb119d0b2711c0dc9ec4bdad28ae9c185ca7e4.tar.gz
tcl-53eb119d0b2711c0dc9ec4bdad28ae9c185ca7e4.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 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;
}