Subject: Fix [2538f373ffc78d6dba9c3d973c147a84fdd9bbd8|2538f373ffc78d6d]: crash in Tcl_OpenTcpServer() on Windows

From: "jan.nijtmans" <[email-masked]>
Date: Fri, 8 Apr 2016 13:27:57 +0000

---
 win/tclWinSock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index a022ed5..da2e60a 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -2061,7 +2061,6 @@ Tcl_OpenTcpServer(
     char channelName[SOCK_CHAN_LENGTH];
     u_long flag = 1;		/* Indicates nonblocking mode. */
     const char *errorMsg = NULL;
-    ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
 
     if (TclpHasSockets(interp) != TCL_OK) {
 	return NULL;
@@ -2177,6 +2176,7 @@ error:
     }
 
     if (statePtr != NULL) {
+	ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey);
 
 	statePtr->acceptProc = acceptProc;
 	statePtr->acceptProcData = acceptProcData;
-- 
cgit v0.12