changeset 5116:4d7027deb1bb

Core: guard against failed allocation during binary upgrade. Patch by Piotr Sikora.
author Ruslan Ermilov <ru@nginx.com>
date Mon, 18 Mar 2013 07:13:57 +0000
parents a29c574d61fa
children 00e4459739ed
files src/core/nginx.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -594,6 +594,9 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, 
     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));