Memory leak? #6

Open
mikegagnon opened this Issue Mar 11, 2012 · 2 comments

Comments

Projects
None yet
3 participants
Contributor

mikegagnon commented Mar 11, 2012

In ngx_http_upstream_fair_module.c, beginning on line 604

/* setup our wrapper around rr */
peers = ngx_palloc(cf->pool, sizeof *peers);
if (peers == NULL) {
    return NGX_ERROR;
}
peers = us->peer.data;

Looks like a bug to allocate memory to peers then immediately re-assign peers to something else. I'm not familiar with nginx code base, so I apologize if this is correct and I am misunderstanding something.

Owner

gnosek commented Mar 12, 2012

Indeed, it looks dumb. I haven't looked at this code for a very long time so I cannot tell you right now what it should be..

But still, the allocation is not a leak thanks to Nginx pools.

fankeke commented May 27, 2015

indeed,I checked the code .
so there is no need to do this:peers = ngx_palloc(cf->pool, sizeof *peers);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment