summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2024-05-16 08:56:01 (GMT)
committersebres <sebres@users.sourceforge.net>2024-05-16 08:56:01 (GMT)
commit03cf1c69bbf2cbf952abeef3db7bf2129756e53b (patch)
treebdacffc44e47e6b2bfec72af438e1b23bbb01f70
parent3144d02e6d0c5999a1f603095254dea140f24964 (diff)
downloadtcl-03cf1c69bbf2cbf952abeef3db7bf2129756e53b.zip
tcl-03cf1c69bbf2cbf952abeef3db7bf2129756e53b.tar.gz
tcl-03cf1c69bbf2cbf952abeef3db7bf2129756e53b.tar.bz2
code review: preserving r/w channels after all possible failures (don't need to release in error case)
-rw-r--r--generic/tclIO.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 31cb48f..80b646b 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -8638,9 +8638,6 @@ TclCopyChannel(
CopyState *csPtr;
int nonBlocking = (cmdPtr) ? CHANNEL_NONBLOCKING : 0;
- TclChannelPreserve(inChan);
- TclChannelPreserve(outChan);
-
inStatePtr = inPtr->state;
outStatePtr = outPtr->state;
@@ -8711,6 +8708,9 @@ TclCopyChannel(
}
csPtr->cmdPtr = cmdPtr;
+ TclChannelPreserve(inChan);
+ TclChannelPreserve(outChan);
+
inStatePtr->csPtrR = csPtr;
outStatePtr->csPtrW = csPtr;