[PATCH] bogotune-0.15.12

David Relson relson at osagesoftware.com
Thu Dec 25 17:15:01 CET 2003


Greetings,

This morning I discovered that the new version of bogotune has a memory
leak.  For each message scored, a 24 byte rstats_t struct is allocated
and not released.  If you're tuning 10,000 ham and 10,000 spam, the leak
costs 480,000 bytes (plus malloc overhead) for each scoring iteration
(of which there are 400 to 500 in a bogotune run).  The problem is fixed
by the following patch below.

David

Index: rstats.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/rstats.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- rstats.c	19 Dec 2003 13:06:57 -0000	1.32
+++ rstats.c	25 Dec 2003 15:51:46 -0000	1.33
@@ -67,7 +67,8 @@
 
 void rstats_init(void)
 {
-    current = (rstats_t *) xcalloc( 1, sizeof(rstats_t));
+    if (current == NULL)
+	current = (rstats_t *) xcalloc( 1, sizeof(rstats_t));
     header.list = current;
     header.count = 0;
     header.robn  = 0;




More information about the Bogofilter mailing list