Hi Dirkjan,

On Wed, May 14, 2014 at 03:08:23PM +0200, Dirkjan Bussink wrote:
> 
> On 02 May 2014, at 11:37, Willy Tarreau <[email protected]> wrote:
> 
> > That said, one of your fix introduces a bug here :
> > 
> > diff --git a/src/haproxy.c b/src/haproxy.c
> > index ed2ff21..c1ec783 100644
> > --- a/src/haproxy.c
> > +++ b/src/haproxy.c
> > @@ -1607,6 +1607,7 @@ int main(int argc, char **argv)
> >                     exit(0); /* parent must leave */
> >             }
> > 
> > +           free(children);
> >             /* if we're NOT in QUIET mode, we should now close the 3 first 
> > FDs to ensure
> >              * that we can detach from the TTY. We MUST NOT do it in other 
> > cases since
> >              * it would have already be done, and 0-2 would have been 
> > affected to listening
> > 
> > Indeed, children is used a few lines below :
> > 
> >                if (proc == global.nbproc) {
> >                        if (global.mode & MODE_SYSTEMD) {
> >                                for (proc = 0; proc < global.nbproc; proc++)
> >                                        while (waitpid(children[proc], NULL, 
> > 0) == -1 && errno == EINTR);
> >                        }
> >                        exit(0); /* parent must leave */
> >                }
> > 
> 
> This is very strange, because it looks like this code is right above the
> free(children) call, not below.

Damn, you're right, I'm sorry for the confusion. I was the one looking
at the wrong place.

> At least that it what it looks like to me. I
> check against latest master just now and see no usage of children anymore
> after the free() call.

Great, that's better this way.

> I did update the patch by setting NULL and also removing the conditionals for
> the other free() calls.
> 
> Attached the fixed patch, if I?m looking in the wrong place for the
> free(children) issue, please let me know!

No you were right, and I was wrong, don't worry :-)
I've just applied your patch.

Thank you!
Willy


Reply via email to