summaryrefslogtreecommitdiffstats
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)
commit0c64074372809648387dba6a96b2f65e7e018aa2 (patch)
tree650271c04450eb0bb8ecb8967aeb9a7d13f62980
parentd12ee9da30592f7dd3121c17b48056fff83824dc (diff)
parent53eb119d0b2711c0dc9ec4bdad28ae9c185ca7e4 (diff)
downloadtcl-0c64074372809648387dba6a96b2f65e7e018aa2.zip
tcl-0c64074372809648387dba6a96b2f65e7e018aa2.tar.gz
tcl-0c64074372809648387dba6a96b2f65e7e018aa2.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
-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;
}
}