From 5a7661e5817532f5e9b08109e9cbc9915d2096f9 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Mon, 18 Mar 2013 07:13:57 +0000 Subject: [PATCH] Core: guard against failed allocation during binary upgrade. Patch by Piotr Sikora. --- src/core/nginx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/nginx.c b/src/core/nginx.c index d02f9111d..e81e7af74 100644 --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -594,6 +594,9 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv) var = ngx_alloc(sizeof(NGINX_VAR) + cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2, cycle->log); + if (var == NULL) { + return NGX_INVALID_PID; + } p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR));