summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2008-02-26 22:30:25 (GMT)
committerhobbs <hobbs>2008-02-26 22:30:25 (GMT)
commitae559634b7b305f4d8c16e010bd926e47a74566a (patch)
treeaa45394dbb070aadc5caf3aefda5811a7017250c
parent36907337fa37b07da48dd6d2f7027a12f58a2316 (diff)
downloadtcl-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).
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclIOCmd.c7
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 <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);