Mercurial > hg > nginx
comparison src/core/nginx.c @ 5158:f1521859b8c2 stable-1.2
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).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 29 Mar 2013 17:51:00 +0000 |
parents | bc92e877d36d |
children | c0497468f521 |
comparison
equal
deleted
inserted
replaced
5157:d6980725e25c | 5158:f1521859b8c2 |
---|---|
592 } | 592 } |
593 | 593 |
594 var = ngx_alloc(sizeof(NGINX_VAR) | 594 var = ngx_alloc(sizeof(NGINX_VAR) |
595 + cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2, | 595 + cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2, |
596 cycle->log); | 596 cycle->log); |
597 if (var == NULL) { | |
598 ngx_free(env); | |
599 return NGX_INVALID_PID; | |
600 } | |
597 | 601 |
598 p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR)); | 602 p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR)); |
599 | 603 |
600 ls = cycle->listening.elts; | 604 ls = cycle->listening.elts; |
601 for (i = 0; i < cycle->listening.nelts; i++) { | 605 for (i = 0; i < cycle->listening.nelts; i++) { |