From dc87e503bd1b4374f3035e725222ed578b5e967b Mon Sep 17 00:00:00 2001 From: hobbs Date: Fri, 27 Oct 2000 22:34:23 +0000 Subject: * generic/tclIO.c (CloseChannel): the statePtr for a channel was not being freed when the last channel in a stack was freed, causing a mem leak. --- generic/tclIO.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 6525b28..16f77cb 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.25 2000/10/06 21:10:50 hobbs Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.26 2000/10/27 22:34:23 hobbs Exp $ */ #include "tclInt.h" @@ -2139,10 +2139,13 @@ CloseChannel(interp, chanPtr, errorCode) /* * There is only the TOP Channel, so we free the remaining - * pointers we have and then ourselves. + * pointers we have and then ourselves. Since this is the + * last of the channels in the stack, make sure to free the + * ChannelState structure associated with it. */ chanPtr->typePtr = NULL; + Tcl_EventuallyFree((ClientData) statePtr, TCL_DYNAMIC); Tcl_EventuallyFree((ClientData) chanPtr, TCL_DYNAMIC); return errorCode; -- cgit v0.12