[PATCH] Core: exit on ngx_pnalloc() failure

Piotr Sikora piotr at cloudflare.com
Sat Aug 2 03:40:08 UTC 2014


# HG changeset patch
# User Piotr Sikora <piotr at cloudflare.com>
# Date 1406950762 25200
#      Fri Aug 01 20:39:22 2014 -0700
# Node ID f9c41363826ff73216a6db3ca9062dd2794bfd69
# Parent  f87afb46ccd26fccc7ed55ca8a7ef89c6256c3f2
Core: exit on ngx_pnalloc() failure.

Signed-off-by: Piotr Sikora <piotr at cloudflare.com>

diff -r f87afb46ccd2 -r f9c41363826f src/os/unix/ngx_process_cycle.c
--- a/src/os/unix/ngx_process_cycle.c	Fri Aug 01 20:04:14 2014 +0900
+++ b/src/os/unix/ngx_process_cycle.c	Fri Aug 01 20:39:22 2014 -0700
@@ -121,6 +121,10 @@ ngx_master_process_cycle(ngx_cycle_t *cy
     }
 
     title = ngx_pnalloc(cycle->pool, size);
+    if (title == NULL) {
+        /* fatal */
+        exit(2);
+    }
 
     p = ngx_cpymem(title, master_process, sizeof(master_process) - 1);
     for (i = 0; i < ngx_argc; i++) {



More information about the nginx-devel mailing list