From fe8364707306c00fca9be80fb480908fc3f37e88 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 16 Mar 2005 17:07:32 +0000 Subject: * cygtls.cc (free_local): New macro. (_cygtls::remove): Use free_local to free known-malloced local variables. * cygtls.h: Mark some variables as "malloced". * net.cc (enum struct_type): Rename from is_* to t_* for clarity. (dump_protoent): Delete. (dup_ent): New macro. (__dup_ent): Renamed from dup_ent. Change arguments for convenience. Replace first argument with newly alloced value. Allocate a rounded number of bytes in an attempt to try to reuse space. Subsume "dump_protent". (cygwin_getprotobyname): Simplify using new dup_ent functionality. (cygwin_getprotobynumber): Ditto. (cygwin_getservbyname): Ditto. (cygwin_getservbyport): Ditto. (cygwin_gethostname): Ditto. (cygwin_gethostbyname): Ditto. * tlsoffsets.h: Regenerate. * syslog.cc (openlog): Use NULL rather than 0, for consistency with the rest of cygwin. (pass_handler::initialize): Use unbuffered I/O in pass one. --- winsup/cygwin/cygtls.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/cygtls.cc') diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc index 817c8e3b1..5b8167f2e 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); -- cgit v1.2.3