aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/cygtls.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/cygtls.cc')
-rw-r--r--winsup/cygwin/cygtls.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc
index 817c8e3..5b8167f 100644
--- a/winsup/cygwin/cygtls.cc
+++ b/winsup/cygwin/cygtls.cc
@@ -149,6 +149,13 @@ _cygtls::fixup_after_fork ()
wq.thread_ev = NULL;
}
+#define free_local(x) \
+ if (locals.x) \
+ { \
+ free (locals.x); \
+ locals.x = NULL; \
+ }
+
void
_cygtls::remove (DWORD wait)
{
@@ -159,8 +166,12 @@ _cygtls::remove (DWORD wait)
// select to control this themselves
if (locals.exitsock != INVALID_SOCKET)
closesocket (locals.exitsock);
- if (locals.process_ident != NULL)
- free (locals.process_ident);
+ free_local (process_ident);
+ free_local (ntoa_buf);
+ free_local (protoent_buf);
+ free_local (servent_buf);
+ free_local (hostent_buf);
+
do
{
sentry here (wait);