Date: Wed, 25 Feb 2009 09:45:52 -0700 From: Bob Beck <beck@ualberta.ca> To: Bob Beck <beck@ualberta.ca> Cc: samm@os2.kiev.ua, Artis Caune <artis.caune@gmail.com>, freebsd-pf@freebsd.org Subject: Re: openbsd spamd is leaking memory? Message-ID: <20090225164552.GW15982@bofh.cns.ualberta.ca> In-Reply-To: <20090225155156.GN15982@bofh.cns.ualberta.ca> References: <9e20d71e0902250435y6e090fb0rc138233242fe7d60@mail.gmail.com> <200902251442.43794.max@love2party.net> <20090225155156.GN15982@bofh.cns.ualberta.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
* Bob Beck <beck@ualberta.ca> [2009-02-25 08:52]:
>
>
> * Max Laier <max@love2party.net> [2009-02-25 06:43]:
> > Hello Artis,
> >
> > looks like a valid catch to me. I'm CC'ing the upstream maintainer (Bob,
> > that's you, right?) From a quick glance there is also a minor leak in
> > readsuffixlists in the goto bad case.
>
> Yeah you're right max, in fact there are three possibilities for
> a slow leak.. try this:
>
actually, try this - dropped a ! in the earlier one. sorry :)
-Bob
Index: grey.c
===================================================================
RCS file: /cvs/src/libexec/spamd/grey.c,v
retrieving revision 1.45
diff -u grey.c
--- grey.c 7 Dec 2008 21:12:52 -0000 1.45
+++ grey.c 25 Feb 2009 16:33:57 -0000
@@ -315,8 +315,11 @@
size_t len;
struct mail_addr *m;
- while (!SLIST_EMPTY(&match_suffix))
+ while (!SLIST_EMPTY(&match_suffix)) {
+ m = SLIST_FIRST(&match_suffix);
SLIST_REMOVE_HEAD(&match_suffix, entry);
+ free(m);
+ }
if ((fp = fopen(alloweddomains_file, "r")) != NULL) {
while ((buf = fgetln(fp, &len))) {
if (buf[len-1] == '\n')
@@ -337,8 +340,11 @@
}
return;
bad:
- while (!SLIST_EMPTY(&match_suffix))
+ while (!SLIST_EMPTY(&match_suffix)) {
+ m = SLIST_FIRST(&match_suffix);
SLIST_REMOVE_HEAD(&match_suffix, entry);
+ free(m);
+ }
}
void
@@ -512,6 +518,7 @@
dbc->act = 0;
dbc->dsiz = 0;
SLIST_REMOVE_HEAD(&db_changes, entry);
+ free(dbc);
}
return(ret);
@@ -737,8 +744,8 @@
if (r)
goto bad;
if (debug)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090225164552.GW15982>
