$NetBSD: patch-ad,v 1.1 2001/01/24 18:42:33 he Exp $

--- ../generic/tclIO.c.orig	Tue Aug  8 02:57:40 2000
+++ ../generic/tclIO.c	Wed Jan 24 16:28:20 2001
@@ -2181,10 +2181,13 @@
 
     /*
      * 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;
