nginx-upstream-fair
nginx-upstream-fair copied to clipboard
Memory leak?
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.
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.
indeed,I checked the code . so there is no need to do this:peers = ngx_palloc(cf->pool, sizeof *peers);