ngx_resolver.c leaks memory?

Igor Sysoev is at
Wed Sep 16 17:57:17 MSD 2009

On Tue, Sep 15, 2009 at 10:28:37PM -0700, Matthew Dempsky wrote:

> I'm still familiarizing myself with nginx's architecture, but it looks
> like ngx_resolver.c leaks memory in a few places.  Before I spend any
> time tracking more down, I thought I'd point out one apparent leak so
> someone can perhaps correct me before I waste my time.
> In ngx_resolver_process_a(), ngx_resolver_copy() is used to
> dynamically allocate memory into  This memory is only
> passed to a few logging functions and to ngx_resolver_lookup_name().
> (The name variable is also reused in the CNAME handling path, but it's
> first overwritten by another call to ngx_resolver_copy().)
> There does not appear to be any code responsible for ensuring that
> is freed.  Is there any deeper architecture preventing this
> memory from being leaked that I've missed?
> Included below is a patch that I believe fixes this particular memory
> leak.  If someone can confirm that this is indeed correct, I'll
> continue investigating the other apparent leaks.

You are right, thank you.

Igor Sysoev

More information about the nginx mailing list