Date: Wed, 25 Feb 2009 08:51:56 -0700 From: Bob Beck <beck@ualberta.ca> To: Max Laier <max@love2party.net> Cc: deraadt@openbsd.org, beck@openbsd.org, samm@os2.kiev.ua, Artis Caune <artis.caune@gmail.com>, freebsd-pf@freebsd.org Subject: Re: openbsd spamd is leaking memory? Message-ID: <20090225155156.GN15982@bofh.cns.ualberta.ca> In-Reply-To: <200902251442.43794.max@love2party.net> References: <9e20d71e0902250435y6e090fb0rc138233242fe7d60@mail.gmail.com> <200902251442.43794.max@love2party.net>
next in thread | previous in thread | raw e-mail | index | archive | help
* 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:
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 15:46:09 -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090225155156.GN15982>
