diff options
author | hobbs <hobbs> | 2008-02-26 22:30:25 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2008-02-26 22:30:25 (GMT) |
commit | ae559634b7b305f4d8c16e010bd926e47a74566a (patch) | |
tree | aa45394dbb070aadc5caf3aefda5811a7017250c /generic | |
parent | 36907337fa37b07da48dd6d2f7027a12f58a2316 (diff) | |
download | tcl-ae559634b7b305f4d8c16e010bd926e47a74566a.zip tcl-ae559634b7b305f4d8c16e010bd926e47a74566a.tar.gz tcl-ae559634b7b305f4d8c16e010bd926e47a74566a.tar.bz2 |
* generic/tclIOCmd.c (Tcl_GetsObjCmd): do not reuse resultObj as
it may be shared (crash condition).
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclIOCmd.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index d49193b..300bef0 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.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: tclIOCmd.c,v 1.15.2.2 2004/07/16 22:38:37 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.15.2.3 2008/02/26 22:30:26 hobbs Exp $ */ #include "tclInt.h" @@ -228,7 +228,7 @@ Tcl_GetsObjCmd(dummy, interp, objc, objv) int lineLen; /* Length of line just read. */ int mode; /* Mode in which channel is opened. */ char *name; - Tcl_Obj *resultPtr, *linePtr; + Tcl_Obj *linePtr; if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 1, objv, "channelId ?varName?"); @@ -264,8 +264,7 @@ Tcl_GetsObjCmd(dummy, interp, objc, objv) Tcl_DecrRefCount(linePtr); return TCL_ERROR; } - resultPtr = Tcl_GetObjResult(interp); - Tcl_SetIntObj(resultPtr, lineLen); + Tcl_SetObjResult(interp, Tcl_NewIntObj(lineLen)); return TCL_OK; } else { Tcl_SetObjResult(interp, linePtr); |