From ae559634b7b305f4d8c16e010bd926e47a74566a Mon Sep 17 00:00:00 2001 From: hobbs Date: Tue, 26 Feb 2008 22:30:25 +0000 Subject: * generic/tclIOCmd.c (Tcl_GetsObjCmd): do not reuse resultObj as it may be shared (crash condition). --- ChangeLog | 5 +++++ generic/tclIOCmd.c | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 645e02e..9f8cd17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-26 Jeff Hobbs + + * generic/tclIOCmd.c (Tcl_GetsObjCmd): do not reuse resultObj as + it may be shared (crash condition). + 2008-02-22 Pat Thoyts * 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); -- cgit v0.12