diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tclIOCmd.c | 7 |
2 files changed, 8 insertions, 4 deletions
@@ -1,3 +1,8 @@ +2008-02-26 Jeff Hobbs <jeffh@ActiveState.com> + + * generic/tclIOCmd.c (Tcl_GetsObjCmd): do not reuse resultObj as + it may be shared (crash condition). + 2008-02-22 Pat Thoyts <patthoyts@users.sourceforge.net> * library/http/pkgIndex.tcl: Set version 2.5.4 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); |