Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak? #6

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

Memory leak? #6

mikegagnon opened this issue Mar 11, 2012 · 2 comments

Comments

@mikegagnon
Copy link
Contributor

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.

@gnosek
Copy link
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
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants