Re: Fwd: [milter-greylist] HEADS-UP: libspf2 causes milter-greylist memory leak?
Hannah Schroeter <[email protected]> Mon, 27 Oct 2008 14:52:15 +0100
| Newsgroups | gmane.mail.spam.spf.devel |
|---|---|
| Organization | Schlund + Partner AG |
| Message-ID | <[email protected]> |
Hi! On Sat, Oct 25, 2008 at 01:48:32AM +0900, Hajimu UMEMOTO wrote: >>>>>> On Fri, 24 Oct 2008 18:02:36 +0200 >>>>>> Fredrik Pettai <[email protected]> said: >pettai> This has been fixed by a patch in the FreeBSD Ports tree. See (and specifically >pettai> patch submission [2]): >pettai> ftp://ftp.freebsd.org/pub/FreeBSD/development/FreeBSD-CVS/ports/mail/libspf2/files/patch-src_libspf2_spf__dns__resolv.c,v >pettai> AFAICS, this fix doesn't seem to be in the latest version of the libspf2-1.2.8 >pettai> source. Maybe someone can add it to libspf2's main CVS branch instead? >Here is a patch against 1.2.8: >Index: src/libspf2/spf_dns_resolv.c >diff -u -p src/libspf2/spf_dns_resolv.c.orig src/libspf2/spf_dns_resolv.c >--- src/libspf2/spf_dns_resolv.c.orig Thu Oct 16 07:02:03 2008 >+++ src/libspf2/spf_dns_resolv.c Fri Oct 24 12:19:29 2008 >@@ -92,7 +92,11 @@ static pthread_key_t res_state_key; > static void > SPF_dns_resolv_thread_term(void *arg) > { >+#ifdef res_ndestroy >+ res_ndestroy( (struct __res_state *)arg ); >+#else > res_nclose( (struct __res_state *)arg ); >+#endif > free(arg); > } I see this, but... >@@ -615,7 +619,7 @@ SPF_dns_resolv_new(SPF_dns_server_t *lay > #if HAVE_DECL_RES_NINIT > pthread_once(&res_state_control, SPF_dns_resolv_init_key); > #else >- if ( res_init() != 0 ) { >+ if ((_res.options & RES_INIT) == 0 && res_init() != 0) { > perror("res_init"); > return NULL; > } Why is that needed, and how portable is that in fact, compared to calling res_init unconditionally in that place? Kind regards, Hannah.