Core: guard against failed allocation during binary upgrade.

Patch by Piotr Sikora.
This commit is contained in:
Ruslan Ermilov 2013-03-18 07:13:57 +00:00
parent bac0cb3bbd
commit 5a7661e581

View File

@ -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));