[PATCH] Guard against failed allocation during binary upgrade

Piotr Sikora piotr at cloudflare.com
Fri Mar 15 21:27:57 UTC 2013


Hey,
pretty obvious patch attached ;)

Best regards,
Piotr Sikora


diff -r a29c574d61fa src/core/nginx.c
--- a/src/core/nginx.c  Fri Mar 15 20:00:49 2013 +0000
+++ b/src/core/nginx.c  Fri Mar 15 14:22:04 2013 -0700
@@ -594,6 +594,9 @@
     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));



More information about the nginx-devel mailing list