summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-01-02 18:35:39 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-01-02 18:35:39 (GMT)
commit812f4dcd814b55e182d7cf35b7867254fe63fe40 (patch)
tree65985498766ca85435a373d9cabaf3ba4af5c775 /generic
parent810edde822b6b99b1dcc766be690db919e90e361 (diff)
parent23c8c8b5e43fffff7f81e26ffa820d4f51cca5c5 (diff)
downloadtcl-812f4dcd814b55e182d7cf35b7867254fe63fe40.zip
tcl-812f4dcd814b55e182d7cf35b7867254fe63fe40.tar.gz
tcl-812f4dcd814b55e182d7cf35b7867254fe63fe40.tar.bz2
merge trunk
Diffstat (limited to 'generic')
-rw-r--r--generic/tclListObj.c17
-rw-r--r--generic/tclThreadTest.c1
2 files changed, 13 insertions, 5 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 3668b45..2d1defa 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -909,6 +909,10 @@ Tcl_ListObjReplace(
isShared = (listRepPtr->refCount > 1);
numRequired = numElems - count + objc;
+ for (i = 0; i < objc; i++) {
+ Tcl_IncrRefCount(objv[i]);
+ }
+
if ((numRequired <= listRepPtr->maxElemCount) && !isShared) {
int shift;
@@ -963,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;
}
}
@@ -1027,14 +1039,11 @@ Tcl_ListObjReplace(
}
/*
- * Insert the new elements into elemPtrs before "first". We don't do a
- * memcpy here because we must increment the reference counts for the
- * added elements, so we must explicitly loop anyway.
+ * Insert the new elements into elemPtrs before "first".
*/
for (i=0,j=first ; i<objc ; i++,j++) {
elemPtrs[j] = objv[i];
- Tcl_IncrRefCount(objv[i]);
}
/*
diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c
index 22b5995..b90e33d 100644
--- a/generic/tclThreadTest.c
+++ b/generic/tclThreadTest.c
@@ -513,7 +513,6 @@ ThreadCreate(
TCL_THREAD_STACK_DEFAULT, joinable) != TCL_OK) {
Tcl_MutexUnlock(&threadMutex);
Tcl_AppendResult(interp, "can't create a new thread", NULL);
- ckfree(ctrl.script);
return TCL_ERROR;
}