diff options
author | rofl0r <rofl0r@users.noreply.github.com> | 2020-09-15 23:11:09 +0100 |
---|---|---|
committer | rofl0r <rofl0r@users.noreply.github.com> | 2020-09-15 23:12:00 +0100 |
commit | 192f8194e1e15c9f13e6a73e71c63ed695bd931e (patch) | |
tree | 7132c0f785a0764a30a9c58e1f7138e1c6b8e20c /src | |
parent | bd92446184fe692e0ceda700945c588ae56cc6cd (diff) |
free() loop records too
Diffstat (limited to 'src')
-rw-r--r-- | src/child.c | 2 | ||||
-rw-r--r-- | src/loop.c | 5 | ||||
-rw-r--r-- | src/loop.h | 1 | ||||
-rw-r--r-- | src/main.c | 4 |
4 files changed, 10 insertions, 2 deletions
diff --git a/src/child.c b/src/child.c index 96864b1..b220da3 100644 --- a/src/child.c +++ b/src/child.c @@ -91,8 +91,6 @@ void child_main_loop (void) childs = sblist_new(sizeof (struct child*), config->maxclients); - loop_records_init(); - for (i = 0; i < nfds; i++) { int *fd = (int *) vector_getentry(listen_fds, i, NULL); fds[i].fd = *fd; @@ -18,6 +18,11 @@ void loop_records_init(void) { loop_records = sblist_new(sizeof (struct loop_record), 32); } +void loop_records_destroy(void) { + sblist_free(loop_records); + loop_records = 0; +} + #if 0 static void su_to_str(union sockaddr_union *addr, char *buf) { int af = addr->v4.sin_family; @@ -4,6 +4,7 @@ #include "sock.h" void loop_records_init(void); +void loop_records_destroy(void); void loop_records_add(union sockaddr_union *addr); int connection_loops (union sockaddr_union *addr); @@ -393,6 +393,8 @@ main (int argc, char **argv) if (daemonized) setup_sig (SIGHUP, takesig, "SIGHUP", argv[0]); setup_sig (SIGUSR1, takesig, "SIGUSR1", argv[0]); + loop_records_init(); + /* Start the main loop */ log_message (LOG_INFO, "Starting main loop. Accepting connections."); @@ -404,6 +406,8 @@ main (int argc, char **argv) child_close_sock (); child_free_children(); + loop_records_destroy(); + /* Remove the PID file */ if (config->pidpath != NULL && unlink (config->pidpath) < 0) { log_message (LOG_WARNING, |