diff options
author | andreas_kupries <akupries@shaw.ca> | 2002-02-14 19:24:15 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2002-02-14 19:24:15 (GMT) |
commit | 2827a2692798a7a0ec46e684a4ccc83afb39859e (patch) | |
tree | da8d61f4ecd9763fff964b2742d187a7b8ea7d45 | |
parent | e071a815b4ff8fff5244e39b85e56311ec78c466 (diff) | |
download | tcl-2827a2692798a7a0ec46e684a4ccc83afb39859e.zip tcl-2827a2692798a7a0ec46e684a4ccc83afb39859e.tar.gz tcl-2827a2692798a7a0ec46e684a4ccc83afb39859e.tar.bz2 |
* generic/tclIOCmd.c (Tcl_GetsObjCmd): Trivial fix for bug
#517503, a memory leak reported by Miguel Sofer
<msofer@users.sourceforge.net>. The leak happens if an error
occurs for "set var [gets $chan]" and leak one empty object.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | generic/tclIOCmd.c | 6 |
2 files changed, 9 insertions, 4 deletions
@@ -1,3 +1,10 @@ +2002-02-14 Andreas Kupries <andreas_kupries@users.sourceforge.net> + + * generic/tclIOCmd.c (Tcl_GetsObjCmd): Trivial fix for bug + #517503, a memory leak reported by Miguel Sofer + <msofer@users.sourceforge.net>. The leak happens if an error + occurs for "set var [gets $chan]" and leak one empty object. + 2002-02-12 David Gravereaux <davygrvy@pobox.com> * djgpp/ (new directory) diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 630efcd..54d0d5c 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.13 2002/01/25 20:40:55 dgp Exp $ + * RCS: @(#) $Id: tclIOCmd.c,v 1.14 2002/02/14 19:24:15 andreas_kupries Exp $ */ #include "tclInt.h" @@ -250,9 +250,7 @@ Tcl_GetsObjCmd(dummy, interp, objc, objv) lineLen = Tcl_GetsObj(chan, linePtr); if (lineLen < 0) { if (!Tcl_Eof(chan) && !Tcl_InputBlocked(chan)) { - if (objc == 3) { - Tcl_DecrRefCount(linePtr); - } + Tcl_DecrRefCount(linePtr); Tcl_ResetResult(interp); Tcl_AppendResult(interp, "error reading \"", name, "\": ", Tcl_PosixError(interp), (char *) NULL); |