aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@nginx.com>2013-03-18 07:13:57 +0000
committerRuslan Ermilov <ru@nginx.com>2013-03-18 07:13:57 +0000
commit5a7661e5817532f5e9b08109e9cbc9915d2096f9 (patch)
tree4d878c2390e5f3ca18bfba83c7b99698ae2c9555 /src
parentbac0cb3bbd507400c9dbac03eacbb6c6937efccd (diff)
downloadnginx-5a7661e5817532f5e9b08109e9cbc9915d2096f9.tar.gz
nginx-5a7661e5817532f5e9b08109e9cbc9915d2096f9.zip
Core: guard against failed allocation during binary upgrade.
Patch by Piotr Sikora.
Diffstat (limited to 'src')
-rw-r--r--src/core/nginx.c3
1 files changed, 3 insertions, 0 deletions
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));