[PATCH] Core: free connections and read/write events at shutdown
Piotr Sikora
piotr at aviatrix.com
Wed Feb 28 01:21:09 UTC 2024
# HG changeset patch
# User Piotr Sikora <piotr at aviatrix.com>
# Date 1708977616 0
# Mon Feb 26 20:00:16 2024 +0000
# Branch patch002
# Node ID f8d9fb94eab212f6e640b7a68ed111562e3157d5
# Parent a8a592b9b62eff7bca03e8b46669f59d2da689ed
Core: free connections and read/write events at shutdown.
Found with LeakSanitizer.
Signed-off-by: Piotr Sikora <piotr at aviatrix.com>
diff -r a8a592b9b62e -r f8d9fb94eab2 src/os/unix/ngx_process_cycle.c
--- a/src/os/unix/ngx_process_cycle.c Mon Feb 26 20:00:11 2024 +0000
+++ b/src/os/unix/ngx_process_cycle.c Mon Feb 26 20:00:16 2024 +0000
@@ -940,6 +940,7 @@
ngx_worker_process_exit(ngx_cycle_t *cycle)
{
ngx_uint_t i;
+ ngx_event_t *rev, *wev;
ngx_connection_t *c;
for (i = 0; cycle->modules[i]; i++) {
@@ -989,8 +990,16 @@
ngx_exit_cycle.files_n = ngx_cycle->files_n;
ngx_cycle = &ngx_exit_cycle;
+ c = cycle->connections;
+ rev = cycle->read_events;
+ wev = cycle->write_events;
+
ngx_destroy_pool(cycle->pool);
+ ngx_free(c);
+ ngx_free(rev);
+ ngx_free(wev);
+
ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0, "exit");
exit(0);
More information about the nginx-devel
mailing list