summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornijtmans@users.sourceforge.net <jan.nijtmans>2012-12-29 09:23:24 (GMT)
committernijtmans@users.sourceforge.net <jan.nijtmans>2012-12-29 09:23:24 (GMT)
commitc1f580b71a42a27775b0592d6e347ce2d1a22d91 (patch)
tree650271c04450eb0bb8ecb8967aeb9a7d13f62980
parent793a88309f03b6a3790f84cac7757bcb42438842 (diff)
parent777dcb68291bfc5cc29447968ac6538185e2293b (diff)
downloadtcl-c1f580b71a42a27775b0592d6e347ce2d1a22d91.zip
tcl-c1f580b71a42a27775b0592d6e347ce2d1a22d91.tar.gz
tcl-c1f580b71a42a27775b0592d6e347ce2d1a22d91.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;
}
}