summaryrefslogtreecommitdiffstats
path: root/win/tclWinThrd.c
diff options
context:
space:
mode:
authorJoe Mistachkin <joe@mistachkin.com>2012-09-13 18:37:55 (GMT)
committerJoe Mistachkin <joe@mistachkin.com>2012-09-13 18:37:55 (GMT)
commit3bb8b9504c9b66c9bc3ac72103318b107f20184a (patch)
tree9964c2577c5d9d5c20a943e5e088dfd810d37859 /win/tclWinThrd.c
parent2aaae6b3fed6fda7473eb417e366fc2e57cd3a5d (diff)
downloadtcl-3bb8b9504c9b66c9bc3ac72103318b107f20184a.zip
tcl-3bb8b9504c9b66c9bc3ac72103318b107f20184a.tar.gz
tcl-3bb8b9504c9b66c9bc3ac72103318b107f20184a.tar.bz2
Free the WinThread structure before running the original thread procedure.
Diffstat (limited to 'win/tclWinThrd.c')
-rw-r--r--win/tclWinThrd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c
index 7abcc29..86ff6a5 100644
--- a/win/tclWinThrd.c
+++ b/win/tclWinThrd.c
@@ -161,13 +161,20 @@ TclWinThreadStart(
{
WinThread *winThreadPtr = (WinThread *) lpParameter;
unsigned int fpmask = _MCW_EM | _MCW_RC | _MCW_PC | _MCW_DN;
+ LPTHREAD_START_ROUTINE lpOrigStartAddress;
+ LPVOID lpOrigParameter;
if (!winThreadPtr) {
return TCL_ERROR;
}
_controlfp(winThreadPtr->fpControl, fpmask);
- return winThreadPtr->lpStartAddress(winThreadPtr->lpParameter);
+
+ lpOrigStartAddress = winThreadPtr->lpStartAddress;
+ lpOrigParameter = winThreadPtr->lpParameter;
+
+ ckfree((char *)winThreadPtr);
+ return lpOrigStartAddress(lpOrigParameter);
}
/*