]> git.kaiwu.me - nginx.git/commitdiff
Core: guard against failed allocation during binary upgrade.
authorRuslan Ermilov <ru@nginx.com>
Mon, 18 Mar 2013 07:13:57 +0000 (07:13 +0000)
committerRuslan Ermilov <ru@nginx.com>
Mon, 18 Mar 2013 07:13:57 +0000 (07:13 +0000)
Patch by Piotr Sikora.

src/core/nginx.c

index d02f9111df8450d38c5a4200c0c34ee58a197460..e81e7af749bc6d6dfdc4a326d66ab0f204fff553 100644 (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));