summaryrefslogtreecommitdiffstats
path: root/generic/tclScan.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)
commit64be4c1e63ef85d515bb28afe134159d649353f6 (patch)
treec2da79f4e5a542014dab31edea47e6bd46a22b4c /generic/tclScan.c
parentab628d4d6d0cbf74b48df435b3d8a2675cc8a0ee (diff)
downloadtcl-64be4c1e63ef85d515bb28afe134159d649353f6.zip
tcl-64be4c1e63ef85d515bb28afe134159d649353f6.tar.gz
tcl-64be4c1e63ef85d515bb28afe134159d649353f6.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/tclScan.c')
-rw-r--r--generic/tclScan.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 693fa60..19cec54 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclScan.c,v 1.12.2.1 2004/08/19 21:12:04 dkf Exp $
+ * RCS: @(#) $Id: tclScan.c,v 1.12.2.2 2005/10/23 22:01:30 msofer Exp $
*/
#include "tclInt.h"
@@ -1168,15 +1168,17 @@ Tcl_ScanObjCmd(dummy, interp, objc, objv)
*/
for (i = 0; i < totalVars; i++) {
if (objs[i] != NULL) {
+ Tcl_Obj *tmpPtr;
+
result++;
- if (Tcl_ObjSetVar2(interp, objv[i+3], NULL,
- objs[i], 0) == NULL) {
+ tmpPtr = Tcl_ObjSetVar2(interp, objv[i+3], NULL, objs[i], 0);
+ Tcl_DecrRefCount(objs[i]);
+ if (tmpPtr == NULL) {
Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
"couldn't set variable \"",
Tcl_GetString(objv[i+3]), "\"", (char *) NULL);
code = TCL_ERROR;
}
- Tcl_DecrRefCount(objs[i]);
}
}
} else {