From 882794a48ef4c92e617a0c6bec02c14ec64d63cf Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 May 2014 13:01:47 +0000 Subject: Revert the iogt-2.5 fix. For now one panic is better than widespread memory leaks. --- generic/tclIO.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index d69a3d9..678dc4b 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -2716,11 +2716,8 @@ FlushChannel( statePtr->outQueueTail = NULL; } RecycleBuffer(statePtr, bufPtr, 0); - bufPtr = NULL; - } - if (bufPtr) { - ReleaseChannelBuffer(bufPtr); } + ReleaseChannelBuffer(bufPtr); } /* Closes "while (1)". */ /* -- cgit v0.12 From 4f9f25fc55b73b0eb82e118bb35b6e41ce173a27 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 May 2014 16:03:50 +0000 Subject: Fix the panic in iogt-2.5. Back in 2011, Bugs 3384654 and 3393276 first noticed troubles with ChannelBuffer sharing, but the magnitude of the problem wasn't truly grasped. A fix was applied that turned out to be more of a band-aid workaround. Now that the real fix is in place, the band-aid is actually preventing it working properly in thie case. Rip it off! --- generic/tclIO.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 678dc4b..8dd9218 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -2312,7 +2312,7 @@ PreserveChannelBuffer( ChannelBuffer *bufPtr) { if (bufPtr->refCount == 0) { - Tcl_Panic("Reuse of ChannelBuffer!"); + Tcl_Panic("Reuse of ChannelBuffer! %p", bufPtr); } bufPtr->refCount++; } @@ -2702,9 +2702,7 @@ FlushChannel( wroteSome = 1; } - if (!IsBufferEmpty(bufPtr)) { - bufPtr->nextRemoved += written; - } + bufPtr->nextRemoved += written; /* * If this buffer is now empty, recycle it. -- cgit v0.12