From 455d0210b2839dfc278572b8c1089030a2697a3b Mon Sep 17 00:00:00 2001 From: crs Date: Wed, 12 May 2004 19:50:58 +0000 Subject: [PATCH] Fixed thread reference leak in network code. --- lib/arch/CArchNetworkBSD.cpp | 5 ++++- lib/arch/CArchNetworkWinsock.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/arch/CArchNetworkBSD.cpp b/lib/arch/CArchNetworkBSD.cpp index d27ab3fd..60253b00 100644 --- a/lib/arch/CArchNetworkBSD.cpp +++ b/lib/arch/CArchNetworkBSD.cpp @@ -827,7 +827,10 @@ const int* CArchNetworkBSD::getUnblockPipe() { CArchMultithreadPosix* mt = CArchMultithreadPosix::getInstance(); - return getUnblockPipeForThread(mt->newCurrentThread()); + CArchThread thread = mt->newCurrentThread(); + const int* p = getUnblockPipeForThread(thread); + ARCH->closeThread(thread); + return p; } const int* diff --git a/lib/arch/CArchNetworkWinsock.cpp b/lib/arch/CArchNetworkWinsock.cpp index b91ba190..0ed630e0 100644 --- a/lib/arch/CArchNetworkWinsock.cpp +++ b/lib/arch/CArchNetworkWinsock.cpp @@ -418,6 +418,7 @@ CArchNetworkWinsock::pollSocket(CPollEntry pe[], int num, double timeout) CArchMultithreadWindows* mt = CArchMultithreadWindows::getInstance(); CArchThread thread = mt->newCurrentThread(); WSAEVENT* unblockEvent = (WSAEVENT*)mt->getNetworkDataForThread(thread); + ARCH->closeThread(thread); if (unblockEvent == NULL) { unblockEvent = new WSAEVENT; *unblockEvent = WSACreateEvent_winsock();