diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2005-11-04 22:38:38 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2005-11-04 22:38:38 (GMT) |
commit | a371489bc6ceddc40588b7fc34595e01989d633d (patch) | |
tree | adcafce2861cb0011abba51ff7721b2c425f5bad /generic/tclCmdIL.c | |
parent | 137f3babeb8df0e8ffaba858265c4472b80adb29 (diff) | |
download | tcl-a371489bc6ceddc40588b7fc34595e01989d633d.zip tcl-a371489bc6ceddc40588b7fc34595e01989d633d.tar.gz tcl-a371489bc6ceddc40588b7fc34595e01989d633d.tar.bz2 |
* generic/tclBinary.c:
* generic/tclCmdAH.c:
* generic/tclCmdIL.c:
* generic/tclCmdMZ.c:
* generic/tclDictObj.c:
* generic/tclExecute.c:
* generic/tclIOCmd.c:
* generic/tclLink.c:
* generic/tclTest.c:
* generic/tclVar.c: fix for [Bug 1334947]. The functions
TclPtrSetVar, Tcl_ObjSetVar2 and Tcl_SetVar2Ex now always consume
the newValuePtr argument - i.e., they will free a 0-refCount
object if they failed to set the variable. Fixed all callers in
the core.
Diffstat (limited to 'generic/tclCmdIL.c')
-rw-r--r-- | generic/tclCmdIL.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 464ac42..12c3e77 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdIL.c,v 1.83 2005/10/19 18:39:58 dgp Exp $ + * RCS: @(#) $Id: tclCmdIL.c,v 1.84 2005/11/04 22:38:38 msofer Exp $ */ #include "tclInt.h" @@ -1012,7 +1012,6 @@ InfoDefaultCmd(dummy, interp, objc, objv) valueObjPtr = Tcl_ObjSetVar2(interp, objv[4], NULL, nullObjPtr, 0); if (valueObjPtr == NULL) { - Tcl_DecrRefCount(nullObjPtr); /* free unneeded obj */ goto defStoreError; } Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); @@ -2260,7 +2259,8 @@ Tcl_LassignObjCmd(dummy, interp, objc, objv) Tcl_Obj **listObjv; /* The contents of the list. */ int listObjc; /* The length of the list. */ int i; - + Tcl_Obj *resPtr; + if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "list varname ?varname ...?"); return TCL_ERROR; @@ -2294,15 +2294,15 @@ Tcl_LassignObjCmd(dummy, interp, objc, objv) */ Tcl_IncrRefCount(valueObj); - if (Tcl_ObjSetVar2(interp, objv[i+2], NULL, valueObj, - TCL_LEAVE_ERR_MSG) == NULL) { - Tcl_DecrRefCount(valueObj); + resPtr = Tcl_ObjSetVar2(interp, objv[i+2], NULL, valueObj, + TCL_LEAVE_ERR_MSG); + TclDecrRefCount(valueObj); + if (resPtr == NULL) { if (emptyObj != NULL) { Tcl_DecrRefCount(emptyObj); } return TCL_ERROR; } - Tcl_DecrRefCount(valueObj); } if (emptyObj != NULL) { Tcl_DecrRefCount(emptyObj); |