summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrofl0r <rofl0r@users.noreply.github.com>2020-09-15 23:11:09 +0100
committerrofl0r <rofl0r@users.noreply.github.com>2020-09-15 23:12:00 +0100
commit192f8194e1e15c9f13e6a73e71c63ed695bd931e (patch)
tree7132c0f785a0764a30a9c58e1f7138e1c6b8e20c
parentbd92446184fe692e0ceda700945c588ae56cc6cd (diff)
free() loop records too
-rw-r--r--src/child.c2
-rw-r--r--src/loop.c5
-rw-r--r--src/loop.h1
-rw-r--r--src/main.c4
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;
diff --git a/src/loop.c b/src/loop.c
index 77b073d..d696760 100644
--- a/src/loop.c
+++ b/src/loop.c
@@ -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;
diff --git a/src/loop.h b/src/loop.h
index 19877d3..27a26c7 100644
--- a/src/loop.h
+++ b/src/loop.h
@@ -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);
diff --git a/src/main.c b/src/main.c
index 8bda2b9..b9c264a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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,