diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2013-03-29 17:51:00 +0000 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2013-03-29 17:51:00 +0000 |
| commit | 188d0c0f5b64f1904056129e1fea27ea6b95cf1b (patch) | |
| tree | ece3831b3cb9d6d86f075b053a68770891bbb580 | |
| parent | 53516741fc0d0e88cfbdbb132771069917ad093d (diff) | |
| download | nginx-188d0c0f5b64f1904056129e1fea27ea6b95cf1b.tar.gz nginx-188d0c0f5b64f1904056129e1fea27ea6b95cf1b.tar.bz2 | |
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).
| -rw-r--r-- | src/core/nginx.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c index d02f9111d..045977691 100644 --- a/src/core/nginx.c +++ b/src/core/nginx.c @@ -594,6 +594,10 @@ 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) { + ngx_free(env); + return NGX_INVALID_PID; + } p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR)); |
