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. 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. 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! — Dirkjan
0001-Fix-a-few-memory-usage-errors.patch
Description: Binary data

