[PATCH] Guard against failed allocation during binary upgrade

Maxim Dounin mdounin at mdounin.ru
Sun Mar 17 00:21:41 UTC 2013


Hello!

On Sat, Mar 16, 2013 at 07:58:38AM +0400, Ruslan Ermilov wrote:

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

Please commit then.

> > 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));
> > 

-- 
Maxim Dounin
http://nginx.org/en/donation.html



More information about the nginx-devel mailing list