From: hno <> Date: Tue, 25 Sep 2007 19:24:59 +0000 (+0000) Subject: Clean up comm memory on exit X-Git-Tag: SQUID_3_0_RC1~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=236d1779d8eae1cb3adee82c8e441105e83f4314;p=thirdparty%2Fsquid.git Clean up comm memory on exit --- diff --git a/src/comm.cc b/src/comm.cc index acd65448fb..8730440657 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.436 2007/09/21 15:16:42 hno Exp $ + * $Id: comm.cc,v 1.437 2007/09/25 13:24:59 hno Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -1841,6 +1841,17 @@ comm_init(void) { conn_close_pool = memPoolCreate("close_handler", sizeof(close_handler)); } +void +comm_exit(void) { + safe_free(fd_table); + safe_free(fdd_table); + if (fdc_table) { + delete[] fdc_table; + fdc_table = NULL; + } + safe_free(commfd_table); +} + /* Write to FD. */ static void commHandleWrite(int fd, void *data) { diff --git a/src/comm.h b/src/comm.h index 89b165894c..db8b62a9bb 100644 --- a/src/comm.h +++ b/src/comm.h @@ -48,6 +48,7 @@ SQUIDCEXTERN void commConnectStart(int fd, const char *, u_short, CNCB *, void * SQUIDCEXTERN int comm_connect_addr(int sock, const struct sockaddr_in *); SQUIDCEXTERN void comm_init(void); +SQUIDCEXTERN void comm_exit(void); SQUIDCEXTERN int comm_open(int, int, struct IN_ADDR, u_short port, int, const char *note); diff --git a/src/fd.cc b/src/fd.cc index 86ca0e9353..12ee236e1d 100644 --- a/src/fd.cc +++ b/src/fd.cc @@ -1,6 +1,6 @@ /* - * $Id: fd.cc,v 1.58 2007/06/25 14:38:14 hno Exp $ + * $Id: fd.cc,v 1.59 2007/09/25 13:24:59 hno Exp $ * * DEBUG: section 51 Filedescriptor Functions * AUTHOR: Duane Wessels @@ -247,12 +247,6 @@ fd_bytes(int fd, int len, unsigned int type) F->bytes_written += len; } -void -fdFreeMemory(void) -{ - safe_free(fd_table); -} - void fdDumpOpen(void) { diff --git a/src/main.cc b/src/main.cc index 290ed20f19..26ffe7cb23 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.449 2007/08/30 21:51:35 hno Exp $ + * $Id: main.cc,v 1.450 2007/09/25 13:24:59 hno Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -1694,7 +1694,7 @@ SquidShutdown() #endif fdDumpOpen(); - fdFreeMemory(); + comm_exit(); memClean(); diff --git a/src/protos.h b/src/protos.h index f36bd7ca28..11429288ca 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.548 2007/08/13 17:20:51 hno Exp $ + * $Id: protos.h,v 1.549 2007/09/25 13:24:59 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -148,7 +148,6 @@ SQUIDCEXTERN void fd_close(int fd); SQUIDCEXTERN void fd_open(int fd, unsigned int type, const char *); SQUIDCEXTERN void fd_note(int fd, const char *); SQUIDCEXTERN void fd_bytes(int fd, int len, unsigned int type); -SQUIDCEXTERN void fdFreeMemory(void); SQUIDCEXTERN void fdDumpOpen(void); SQUIDCEXTERN int fdNFree(void); SQUIDCEXTERN int fdUsageHigh(void);