Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: [milter-greylist] HEADS-UP: libpspf2 & libspf-alt cause milter-greylist memory leak

2008-10-24 by Petar Bogdanovic

On Fri, Oct 24, 2008 at 05:27:18AM +0200, manu@... wrote:
> Petar Bogdanovic <petar@...> wrote:
> 
> > > The BIND9's resolver requires res_ndestroy() for cleanup res_state.
> > > However, libspf2 doesn't issue res_ndestroy() but issues res_nclose().
> > > It causes memory leak.  The FreeBSD port of libspf2 has a patch to
> > > address this issue.
> > 
> > Thanks, I applied all patches (~10) from the FreeBSD Ports tree and the
> > problem is gone. The memory usage of milter-greylist is actually frozen
> > now, no matter how hard I try. Also, the claimed cpu-time is much lower.
> 
> I have nothing to add about libspf2, I just changed the title so that
> other people do not miss that.

milter-greylist using libspf-alt leaks too but I didn't try to patch it.
A quick check reveals that they don't use res_ndestroy() either:

	[petar@pintail ~/tmp/libspf_alt-0.4.0/lib/spf_alt]
	$ grep -r res_ .
	./spf_dns_resolv.c:    struct __res_state	res_state;
	./spf_dns_resolv.c:#define SPF_h_errno spfhook->res_state.res_h_errno
	./spf_dns_resolv.c:    dns_len = res_nquery( &spfhook->res_state, domain, ns_c_in, rr_type,
	./spf_dns_resolv.c:    dns_len = res_query( domain, ns_c_in, rr_type,
	./spf_dns_resolv.c:    if ( res_ninit( &spfhook->res_state ) != 0 )
	./spf_dns_resolv.c:    if ( res_init() != 0 )
	./spf_dns_resolv.c:	res_nclose( &spfhook->res_state );
	./spf_dns_resolv.c:	res_close();

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.