mirror of
https://github.com/nginx/nginx.git
synced 2025-07-21 19:56:23 +08:00
Merge of r5117, r5123: allocation errors handing during upgrade.
*) Core: guard against failed allocation during binary upgrade. Patch by Piotr Sikora. *) Core: fixed resource leak if binary upgrade fails due to no memory. Found by Coverity (CID 992320).
This commit is contained in:
parent
53516741fc
commit
188d0c0f5b
@ -594,6 +594,10 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
|
|||||||
var = ngx_alloc(sizeof(NGINX_VAR)
|
var = ngx_alloc(sizeof(NGINX_VAR)
|
||||||
+ cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2,
|
+ cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2,
|
||||||
cycle->log);
|
cycle->log);
|
||||||
|
if (var == NULL) {
|
||||||
|
ngx_free(env);
|
||||||
|
return NGX_INVALID_PID;
|
||||||
|
}
|
||||||
|
|
||||||
p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR));
|
p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user