[PATCH] Core: fix a memory leak in Nginx signaller processes

Vladimir Krivopalov vladimir.krivopalov at gmail.com
Mon Dec 16 20:41:58 UTC 2019


# HG changeset patch
# User Vladimir Krivopalov <vladimir.krivopalov at gmail.com>
# Date 1576294741 -10800
#      Sat Dec 14 06:39:01 2019 +0300
# Node ID 42531fd29c6203016f5d789d1b23dc377f1be880
# Parent  3939483cd1b56b202a99b1db344d9568b0958e67
Core: fix a memory leak in Nginx signaller processes.

A memory pool created by the 'main()' function is not destroyed when
Nginx is run as a signaller process.
Signaller processes are inherently short-lived so this does not cause
any noticeable memory overhead. However, memory leaks detectors such as
AddressSanitizer and Valgrind report this issue and cause Nginx to exit
with a failure core.

diff -r 3939483cd1b5 -r 42531fd29c62 src/core/ngx_cycle.c
--- a/src/core/ngx_cycle.c    Thu Dec 05 19:38:06 2019 +0300
+++ b/src/core/ngx_cycle.c    Sat Dec 14 06:39:01 2019 +0300
@@ -303,6 +303,9 @@
     }

     if (ngx_process == NGX_PROCESS_SIGNALLER) {
+        ngx_destroy_pool(old_cycle->pool);
+        cycle->old_cycle = NULL;
+
         return cycle;
     }


More information about the nginx-devel mailing list