On Fri, 30 Jul 2004, Tomasz Kojm wrote:

On Thu, 29 Jul 2004 18:21:23 -0400 (EDT)
Igor Brezac <[EMAIL PROTECTED]> wrote:


On Thu, 29 Jul 2004, Mike Lambert wrote:

OS: FreeBSD 4.9-RELEASE-p2
ClamAV: devel-20040728

Build options:
--enable-milter
--disable-clamuko
--enable-bigstack
--disable-dependency-tracking

In 24 hours of running, memory usage for clamd (devel-20040728) has
steadily increased from 5MB to 63MB.

Does anyone have suggestions for building/configuring clamd on
FreeBSD to stop or at least reduce the leaks?  Version 0.70 leaked,
but not nearly as bad as this snapshot. Does version 0.75 leak much?

It leaks on Solaris 9 as well (snapshot from today). I am not very intimate with the clamd code, but a quick run through a profiler (FncCheck) shows that the leak may come from cli_parse_add(). I cannot find where bm_new structure is freed. If any of the developers

in matcher.c:cl_free()

--
  oo    .....         Tomasz Kojm <[EMAIL PROTECTED]>
 (\/)\.........         http://www.ClamAV.net/gpg/tkojm.gpg
    \..........._         0DCA5A08407D5288279DB43454822DC8985A444B
      //\   /\              Fri Jul 30 00:47:46 CEST 2004



How about this?

--- matcher-bm.c.orig   Mon Jul 19 13:54:40 2004
+++ matcher-bm.c        Thu Jul 29 21:59:42 2004
@@ -91,11 +91,27 @@

 void cli_bm_free(struct cl_node *root)
 {
+    struct cli_bm_patt *b1, *b2;
+    int i;
+
     if(root->bm_shift)
        free(root->bm_shift);

-    if(root->bm_suffix)
+    if(root->bm_suffix) {
+       for(i = 0; i < 65536; i++) {
+           b1 = root->bm_suffix[i];
+           while(b1) {
+               b2 = b1;
+               b1 = b1->next;
+               if (b2->virname)
+                   free(b2->virname);
+               if (b2->pattern)
+                   free(b2->pattern);
+               free(b2);
+           }
+       }
        free(root->bm_suffix);
+    }
 }

 int cli_bm_scanbuff(const char *buffer, unsigned int length, const char **virname, 
const struct cl_node *root)

--
Igor


------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com _______________________________________________ Clamav-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/clamav-users

Reply via email to