[PATCH] Guard against failed allocation during binary upgrade

Ruslan Ermilov ru at nginx.com
Sat Mar 16 03:58:38 UTC 2013


On Fri, Mar 15, 2013 at 02:27:57PM -0700, Piotr Sikora wrote:
> Hey,
> pretty obvious patch attached ;)

Your patch obviously looks good.  :)

> 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