summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdAH.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2005-10-23 22:01:27 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2005-10-23 22:01:27 (GMT)
commit337481bde00a01912f25ffeda6d5bd4351057c7d (patch)
treec2da79f4e5a542014dab31edea47e6bd46a22b4c /generic/tclCmdAH.c
parent352f9db6131a948693af4acd7d5ae471c54635c2 (diff)
downloadtcl-337481bde00a01912f25ffeda6d5bd4351057c7d.zip
tcl-337481bde00a01912f25ffeda6d5bd4351057c7d.tar.gz
tcl-337481bde00a01912f25ffeda6d5bd4351057c7d.tar.bz2
* generic/tclBasic.c:
* generic/tclBinary.c: * generic/tclCmdAH.c: * generic/tclCmdIL.c: * generic/tclCmdMZ.c: * generic/tclExecute.c: * generic/tclLink.c: * generic/tclMain.c: * generic/tclProc.c: * generic/tclScan.c: * generic/tclTest.c: * generic/tclVar.c: * mac/tclMacInit.c: * unix/tclUnixInit.c: * win/tclWinInit.c: Insure that the core never calls TclPtrSetVar, Tcl_SetVar2Ex, Tcl_ObjSetVar2 or Tcl_SetObjErrorCode with a 0-ref new value. It is not possible to handle error returns correctly in that case [Bug 1334947], one has the choice of leaking the object in some cases, or else risk crashing in some others.
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r--generic/tclCmdAH.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index aaf37ac..c3402ef 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdAH.c,v 1.27.2.14 2005/10/13 21:45:32 dkf Exp $
+ * RCS: @(#) $Id: tclCmdAH.c,v 1.27.2.15 2005/10/23 22:01:29 msofer Exp $
*/
#include "tclInt.h"
@@ -1826,20 +1826,17 @@ Tcl_ForeachObjCmd(dummy, interp, objc, objv)
for (v = 0; v < varcList[i]; v++) {
int k = index[i]++;
Tcl_Obj *valuePtr, *varValuePtr;
- int isEmptyObj = 0;
if (k < argcList[i]) {
valuePtr = argvList[i][k];
} else {
valuePtr = Tcl_NewObj(); /* empty string */
- isEmptyObj = 1;
}
+ Tcl_IncrRefCount(valuePtr);
varValuePtr = Tcl_ObjSetVar2(interp, varvList[i][v],
NULL, valuePtr, 0);
+ Tcl_DecrRefCount(valuePtr);
if (varValuePtr == NULL) {
- if (isEmptyObj) {
- Tcl_DecrRefCount(valuePtr);
- }
Tcl_ResetResult(interp);
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"couldn't set loop variable: \"",