Hi all,

On our busy mailserver we see clamd leaking mem like hell. I've now used valgrind to debug this a bit further.

We use ClamAV devel-20050511 on FreeBSD 5.4 release, but I have seen the
memleak on the devel port since ever. After scanning 10'000 mails, clamd has
grown over 100MB, after an hour it is 200MB big. I doesn't matter which threading library we use, it happens on both libc_r and libpthreads. The strange thing is that on average load during evening, the probem doesn't happen. Only if we get a lot of mails (3-5 per second), the problem shows up.


Now to the valgrind output:

record 26 I, and record 24 in II seem to be normal, those are the cached virus-databases.

But what about record 25 in I and recore 26 in II ? This seems to be the responsable place for the leak. But looking at the source I can't find
the leak which is responsable:


textDestroy(text *t_head)
{
        while(t_head) {
                text *t_next = t_head->t_next;
                if(t_head->t_line)
                        (void)lineUnlink(t_head->t_line);
                free(t_head);
                t_head = t_next;
        }
}

looks quite normal to me. Any obvious bug here ?

Martin



==71752== 12482134 bytes in 332365 blocks are still reachable in loss record 26 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C04DDC6: cli_malloc (others.c:301)
==71752== by 0x3C060D46: messageAddStr (message.c:857)
==71752== by 0x3C05B1BB: cli_parse_mbox (mbox.c:884)
==71752== by 0x3C05AE7F: cli_mbox (mbox.c:694)
==71752== by 0x3C05628C: cli_scanmail (scanners.c:1305)
==71752== by 0x3C056801: cli_magic_scandesc (scanners.c:1409)
==71752== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==71752== by 0x3C056F9A: cl_scanfile (scanners.c:1564)


valgrind -v --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes --num-callers=9 /docsis/sbin/clamd
==68928== Memcheck, a memory error detector for x86-linux.
==68928== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward.
==68928== Using valgrind-2.1.2.CVS, a program supervision framework for x86-linux.
==68928== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward.
==68928== Valgrind library directory: /usr/local/lib/valgrind
==68928== Command line
==68928== /docsis/sbin/clamd
==68928== Startup, with flags:
==68928== -v
==68928== --tool=memcheck
==68928== --leak-check=yes
==68928== --show-reachable=yes
==68928== --trace-children=yes
==68928== --num-callers=9


==68928== at 0x3C194BF1: strstr (strstr.c:59)
==68928== by 0x3C0610B3: messageIsEncoding (message.c:958)
==68928== by 0x3C060EBF: messageAddStr (message.c:897)
==68928== by 0x3C05B1BB: cli_parse_mbox (mbox.c:884)
==68928== by 0x3C05AE7F: cli_mbox (mbox.c:694)
==68928== by 0x3C05628C: cli_scanmail (scanners.c:1305)
==68928== by 0x3C056801: cli_magic_scandesc (scanners.c:1409)
==68928== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==68928== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==68928==
==68928== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==68928== malloc/free: in use at exit: 9711429 bytes in 269894 blocks.
==68928== malloc/free: 525814 allocs, 255920 frees, 259372343 bytes allocated.
==68928==
==68928== searching for pointers to 269894 not-freed blocks.
==68928== checked 14510220 bytes.
==68928==
==68928== 29 bytes in 1 blocks are still reachable in loss record 1 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C13A38D: setenv (setenv.c:96)
==68928== by 0x3C103B31: putenv (putenv.c:57)
==68928== by 0x3C04DFAE: cl_settempdir (others.c:362)
==68928== by 0x804D634: clamd (clamd.c:247)
==68928== by 0x804CAB8: main (options.c:114)
==68928==
==68928==
==68928== 29 bytes in 1 blocks are definitely lost in loss record 2 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C04DDC6: cli_malloc (others.c:301)
==68928== by 0x3C04DF84: cl_settempdir (others.c:360)
==68928== by 0x804D634: clamd (clamd.c:247)
==68928== by 0x804CAB8: main (options.c:114)
==68928==
==68928==
==68928== 72 bytes in 1 blocks are still reachable in loss record 3 of 26
==68928== at 0x3C040F63: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C059E02: zzip_dir_alloc_ext_io (zzip-zip.c:510)
==68928== by 0x3C059FE2: zzip_dir_fdopen_ext_io (zzip-zip.c:596)
==68928== by 0x3C059FB8: zzip_dir_fdopen (zzip-zip.c:580)
==68928== by 0x3C05364F: cli_scanzip (scanners.c:282)
==68928== by 0x3C056665: cli_magic_scandesc (scanners.c:1382)
==68928== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==68928== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==68928== by 0x8050247: dirscan (scanner.c:156)
==68928==
==68928==
==68928== 88 bytes in 1 blocks are still reachable in loss record 4 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C13A2D3: setenv (setenv.c:86)
==68928== by 0x3C103B31: putenv (putenv.c:57)
==68928== by 0x3C04DFAE: cl_settempdir (others.c:362)
==68928== by 0x804D634: clamd (clamd.c:247)
==68928== by 0x804CAB8: main (options.c:114)
==68928==
==68928==
==68928== 108 bytes in 1 blocks are still reachable in loss record 5 of 26
==68928== at 0x3C040F63: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C057D2F: zzip_file_open (zzip-file.c:210)
==68928== by 0x3C053BA9: cli_scanzip (scanners.c:424)
==68928== by 0x3C056665: cli_magic_scandesc (scanners.c:1382)
==68928== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==68928== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==68928== by 0x8050247: dirscan (scanner.c:156)
==68928== by 0x805068C: scan (scanner.c:251)
==68928== by 0x804E144: command (session.c:84)
==68928==
==68928==
==68928== 114 bytes in 1 blocks are still reachable in loss record 6 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C059B12: __zzip_parse_root_directory (zzip-zip.c:355)
==68928== by 0x3C05A10E: __zzip_dir_parse (zzip-zip.c:643)
==68928== by 0x3C05A007: zzip_dir_fdopen_ext_io (zzip-zip.c:600)
==68928== by 0x3C059FB8: zzip_dir_fdopen (zzip-zip.c:580)
==68928== by 0x3C05364F: cli_scanzip (scanners.c:282)
==68928== by 0x3C056665: cli_magic_scandesc (scanners.c:1382)
==68928== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==68928== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==68928==
==68928==
==68928== 140 bytes in 7 blocks are still reachable in loss record 7 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C1A4005: telldir (telldir.c:68)
==68928== by 0x3C1A33D4: __opendir2 (opendir.c:277)
==68928== by 0x3C1A2DA4: opendir (opendir.c:62)
==68928== by 0x3C054A4F: cli_scandir (scanners.c:790)
==68928== by 0x3C0562FB: cli_scanmail (scanners.c:1312)
==68928== by 0x3C056801: cli_magic_scandesc (scanners.c:1409)
==68928== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==68928== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==68928==
==68928==
==68928== 200 bytes in 1 blocks are definitely lost in loss record 8 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C0C68C0: (within /usr/local/lib/valgrind/libpthread.so.1)
==68928== by 0x3C0C91A5: (within /usr/local/lib/valgrind/libpthread.so.1)
==68928== by 0x3C0C9331: pthread_key_create (in /usr/local/lib/valgrind/libpthread.so.1)
==68928== by 0x3C0CA072: (within /usr/local/lib/valgrind/libpthread.so.1)
==68928== by 0x3C0C7818: pthread_create (in /usr/local/lib/valgrind/libpthread.so.1)
==68928== by 0x804EC6E: thrmgr_dispatch (thrmgr.c:248)
==68928== by 0x804FC0A: acceptloop_th (server-th.c:528)
==68928== by 0x804DFC7: localserver (localserver.c:108)
==68928==
==68928==
==68928== 260 bytes in 12 blocks are still reachable in loss record 9 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C0C68C0: (within /usr/local/lib/valgrind/libpthread.so.1)
==68928== by 0x3C0C7F3D: pthread_mutex_init (in /usr/local/lib/valgrind/libpthread.so.1)
==68928== by 0x3C0C7F9C: pthread_mutex_lock (in /usr/local/lib/valgrind/libpthread.so.1)
==68928== by 0x804A320: logg (output.c:116)
==68928== by 0x804D20A: clamd (clamd.c:144)
==68928== by 0x804CAB8: main (options.c:114)
==68928==
==68928==
==68928== 336 bytes in 7 blocks are still reachable in loss record 10 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C1A2EB2: __opendir2 (opendir.c:96)
==68928== by 0x3C1A2DA4: opendir (opendir.c:62)
==68928== by 0x3C054A4F: cli_scandir (scanners.c:790)
==68928== by 0x3C0562FB: cli_scanmail (scanners.c:1312)
==68928== by 0x3C056801: cli_magic_scandesc (scanners.c:1409)
==68928== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==68928== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==68928== by 0x8050247: dirscan (scanner.c:156)
==68928==
==68928==
==68928== 381 bytes in 7 blocks are still reachable in loss record 11 of 26
==68928== at 0x3C040F63: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x804C4CA: mcalloc (memory.c:40)
==68928== by 0x804C8D7: main (options.c:66)
==68928==
==68928==
==68928== 400 bytes in 1 blocks are still reachable in loss record 12 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C18DEDF: ??? (y.tab.c:308)
==68928== by 0x3C18E00F: _nsyyparse (y.tab.c:371)
==68928== by 0x3C19174F: ??? (nsdispatch.c:353)
==68928== by 0x3C191F3B: _nsdispatch (nsdispatch.c:595)
==68928== by 0x3C1633A7: getpwnam_r (getpwent.c:303)
==68928== by 0x3C163657: ??? (getpwent.c:401)
==68928== by 0x3C163576: ??? (getpwent.c:377)
==68928== by 0x3C163701: getpwnam (getpwent.c:427)
==68928==
==68928==
==68928== 541 bytes in 55 blocks are still reachable in loss record 13 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C1A0025: strdup (strdup.c:52)
==68928== by 0x3C18E90C: _nsyylex (nslexer.l:88)
==68928== by 0x3C18E078: _nsyyparse (y.tab.c:380)
==68928== by 0x3C19174F: ??? (nsdispatch.c:353)
==68928== by 0x3C191F3B: _nsdispatch (nsdispatch.c:595)
==68928== by 0x3C1633A7: getpwnam_r (getpwent.c:303)
==68928== by 0x3C163657: ??? (getpwent.c:401)
==68928== by 0x3C163576: ??? (getpwent.c:377)
==68928==
==68928==
==68928== 680 bytes in 31 blocks are still reachable in loss record 14 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x804C47C: mmalloc (memory.c:27)
==68928== by 0x804B31F: regcfg (cfgparser.c:285)
==68928== by 0x804ACA6: parsecfg (cfgparser.c:155)
==68928== by 0x804D04C: clamd (clamd.c:106)
==68928== by 0x804CAB8: main (options.c:114)
==68928==
==68928==
==68928== 724 bytes in 15 blocks are still reachable in loss record 15 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C040FDC: realloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C1913BF: ??? (nsdispatch.c:193)
==68928== by 0x3C191599: _nsdbtaddsrc (nsdispatch.c:269)
==68928== by 0x3C18DE36: ??? (nsparser.y:177)
==68928== by 0x3C18E3C5: _nsyyparse (nsparser.y:113)
==68928== by 0x3C19174F: ??? (nsdispatch.c:353)
==68928== by 0x3C191F3B: _nsdispatch (nsdispatch.c:595)
==68928== by 0x3C1633A7: getpwnam_r (getpwent.c:303)
==68928==
==68928==
==68928== 800 bytes in 1 blocks are still reachable in loss record 16 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C18DF57: ??? (y.tab.c:314)
==68928== by 0x3C18E00F: _nsyyparse (y.tab.c:371)
==68928== by 0x3C19174F: ??? (nsdispatch.c:353)
==68928== by 0x3C191F3B: _nsdispatch (nsdispatch.c:595)
==68928== by 0x3C1633A7: getpwnam_r (getpwent.c:303)
==68928== by 0x3C163657: ??? (getpwent.c:401)
==68928== by 0x3C163576: ??? (getpwent.c:377)
==68928== by 0x3C163701: getpwnam (getpwent.c:427)
==68928==
==68928==
==68928== 1024 bytes in 1 blocks are still reachable in loss record 17 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C163521: ??? (getpwent.c:371)
==68928== by 0x3C163701: getpwnam (getpwent.c:427)
==68928== by 0x804D441: clamd (clamd.c:203)
==68928== by 0x804CAB8: main (options.c:114)
==68928==
==68928==
==68928== 1066 bytes in 2 blocks are still reachable in loss record 18 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C18F861: ??? (stdout:1675)
==68928== by 0x3C18F460: _nsyy_create_buffer (stdout:1350)
==68928== by 0x3C18E6AF: _nsyylex (stdout:677)
==68928== by 0x3C18E078: _nsyyparse (y.tab.c:380)
==68928== by 0x3C19174F: ??? (nsdispatch.c:353)
==68928== by 0x3C191F3B: _nsdispatch (nsdispatch.c:595)
==68928== by 0x3C1633A7: getpwnam_r (getpwent.c:303)
==68928== by 0x3C163657: ??? (getpwent.c:401)
==68928==
==68928==
==68928== 6240 bytes in 3 blocks are still reachable in loss record 19 of 26
==68928== at 0x3C04105B: realloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C04DEC1: cli_realloc (others.c:336)
==68928== by 0x3C04A49C: cli_ac_addpatt (matcher-ac.c:68)
==68928== by 0x3C04ED4F: cli_ac_addsig (readdb.c:230)
==68928== by 0x3C04F357: cli_parse_add (readdb.c:377)
==68928== by 0x3C0574E8: cli_addtypesigs (filetypes.c:277)
==68928== by 0x3C04A7CF: cli_ac_buildtrie (matcher-ac.c:181)
==68928== by 0x3C04C283: cl_build (matcher.c:366)
==68928== by 0x804D77D: clamd (clamd.c:273)
==68928==
==68928==
==68928== 28672 bytes in 7 blocks are still reachable in loss record 20 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C1A3383: __opendir2 (opendir.c:262)
==68928== by 0x3C1A2DA4: opendir (opendir.c:62)
==68928== by 0x804FFDE: dirscan (scanner.c:118)
==68928== by 0x805068C: scan (scanner.c:251)
==68928== by 0x804E144: command (session.c:84)
==68928== by 0x804ED7A: scanner_thread (server-th.c:88)
==68928== by 0x804EB21: thrmgr_worker (thrmgr.c:199)
==68928== by 0x3C0C7686: (within /usr/local/lib/valgrind/libpthread.so.1)
==68928==
==68928==
==68928== 32768 bytes in 1 blocks are still reachable in loss record 21 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C057D90: zzip_file_open (zzip-file.c:222)
==68928== by 0x3C053BA9: cli_scanzip (scanners.c:424)
==68928== by 0x3C056665: cli_magic_scandesc (scanners.c:1382)
==68928== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==68928== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==68928== by 0x8050247: dirscan (scanner.c:156)
==68928== by 0x805068C: scan (scanner.c:251)
==68928== by 0x804E144: command (session.c:84)
==68928==
==68928==
==68928== 55175 bytes in 3146 blocks are still reachable in loss record 22 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C052E36: cli_strtok (str.c:247)
==68928== by 0x804AB54: parsecfg (cfgparser.c:139)
==68928== by 0x804D04C: clamd (clamd.c:106)
==68928== by 0x804CAB8: main (options.c:114)
==68928==
==68928==
==68928== 81920 bytes in 5 blocks are still reachable in loss record 23 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C1BD0DE: __smakebuf (makebuf.c:74)
==68928== by 0x3C1BD007: __swsetup (wsetup.c:84)
==68928== by 0x3C1B5FC8: __vfprintf (vfprintf.c:645)
==68928== by 0x3C1B5F28: vfprintf (vfprintf.c:405)
==68928== by 0x804A6A7: logg (output.c:179)
==68928== by 0x804D20A: clamd (clamd.c:144)
==68928== by 0x804CAB8: main (options.c:114)
==68928==
==68928==
==68928== 831908 bytes in 29711 blocks are still reachable in loss record 24 of 26
==68928== at 0x3C040F63: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C04F391: cli_parse_add (readdb.c:383)
==68928== by 0x3C04F780: cli_loaddb (readdb.c:479)
==68928== by 0x3C050AFA: cl_loaddb (readdb.c:906)
==68928== by 0x3C050F79: cl_loaddbdir (readdb.c:994)
==68928== by 0x3C052680: cli_cvdload (cvd.c:426)
==68928== by 0x3C050B63: cl_loaddb (readdb.c:914)
==68928== by 0x3C050F79: cl_loaddbdir (readdb.c:994)
==68928== by 0x804D6D8: clamd (clamd.c:260)
==68928==
==68928==
==68928== 3564574 bytes in 160483 blocks are still reachable in loss record 25 of 26
==68928== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C04DDC6: cli_malloc (others.c:301)
==68928== by 0x3C060BE9: messageAddLine (message.c:794)
==68928== by 0x3C05C885: parseEmailBody (mbox.c:1830)
==68928== by 0x3C05B365: cli_parse_mbox (mbox.c:930)
==68928== by 0x3C05AE7F: cli_mbox (mbox.c:694)
==68928== by 0x3C05628C: cli_scanmail (scanners.c:1305)
==68928== by 0x3C056801: cli_magic_scandesc (scanners.c:1409)
==68928== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==68928==
==68928==
==68928== 5103180 bytes in 76392 blocks are still reachable in loss record 26 of 26
==68928== at 0x3C040F63: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==68928== by 0x3C04DE55: cli_calloc (others.c:321)
==68928== by 0x3C04E63B: cli_ac_addsig (readdb.c:71)
==68928== by 0x3C04F29A: cli_parse_add (readdb.c:367)
==68928== by 0x3C04F780: cli_loaddb (readdb.c:479)
==68928== by 0x3C050AFA: cl_loaddb (readdb.c:906)
==68928== by 0x3C050F79: cl_loaddbdir (readdb.c:994)
==68928== by 0x3C052680: cli_cvdload (cvd.c:426)
==68928== by 0x3C050B63: cl_loaddb (readdb.c:914)
==68928==
==68928== LEAK SUMMARY:
==68928== definitely lost: 229 bytes in 2 blocks.
==68928== possibly lost: 0 bytes in 0 blocks.
==68928== still reachable: 9711200 bytes in 269892 blocks.
==68928== suppressed: 0 bytes in 0 blocks.
--68928-- TT/TC: 0 tc sectors discarded.
--68928-- 8496 chainings, 0 unchainings.
--68928-- translate: new 9875 (173753 -> 2189276; ratio 125:10)
--68928-- discard 0 (0 -> 0; ratio 0:10).
--68928-- dispatch: 824257450 jumps (bb entries), of which 74522692 (9%) were unchained.
--68928-- 36109/1052276 major/minor sched events. 189371 tt_fast misses.
--68928-- reg-alloc: 1723 t-req-spill, 390179+12767 orig+spill uis, 48785 total-reg-r.
--68928-- sanity: 35203 cheap, 1409 expensive checks.
--68928-- ccalls: 43467 C calls, 54% saves+restores avoided (139460 bytes)
--68928-- 59167 args, avg 0.89 setup instrs each (12176 bytes)
--68928-- 0% clear the stack (130401 bytes)
--68928-- 19119 retvals, 25% of reg-reg movs avoided (9446 bytes)


and I did run it a second time (waiting 20 seconds longer)

valgrind -v --tool=memcheck --leak-check=yes --show-reachable=yes --trace-children=yes --num-callers=9 /docsis/sbin/clamd
==71752== Memcheck, a memory error detector for x86-linux.
==71752== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward.
==71752== Using valgrind-2.1.2.CVS, a program supervision framework for x86-linux.
==71752== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward.
==71752== Valgrind library directory: /usr/local/lib/valgrind
==71752== Command line
==71752== /docsis/sbin/clamd
==71752== Startup, with flags:
==71752== -v
==71752== --tool=memcheck
==71752== --leak-check=yes
==71752== --show-reachable=yes
==71752== --trace-children=yes
==71752== --num-callers=9


==71752== at 0x3C03FE91: strchr (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C062803: decodeLine (message.c:1873)
==71752== by 0x3C061E90: messageExport (message.c:1440)
==71752== by 0x3C06202D: messageToFileblob (message.c:1496)
==71752== by 0x3C05D10D: parseEmailBody (mbox.c:2191)
==71752== by 0x3C05B365: cli_parse_mbox (mbox.c:930)
==71752== by 0x3C05AE7F: cli_mbox (mbox.c:694)
==71752== by 0x3C05628C: cli_scanmail (scanners.c:1305)
==71752== by 0x3C056801: cli_magic_scandesc (scanners.c:1409)
==71752==
==71752== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==71752== malloc/free: in use at exit: 20121979 bytes in 442084 blocks.
==71752== malloc/free: 945133 allocs, 503049 frees, 599452748 bytes allocated.
==71752==
==71752== searching for pointers to 442084 not-freed blocks.
==71752== checked 25052648 bytes.
==71752==
==71752== 29 bytes in 1 blocks are still reachable in loss record 1 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C13A38D: setenv (setenv.c:96)
==71752== by 0x3C103B31: putenv (putenv.c:57)
==71752== by 0x3C04DFAE: cl_settempdir (others.c:362)
==71752== by 0x804D634: clamd (clamd.c:247)
==71752== by 0x804CAB8: main (options.c:114)
==71752==
==71752==
==71752== 29 bytes in 1 blocks are definitely lost in loss record 2 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C04DDC6: cli_malloc (others.c:301)
==71752== by 0x3C04DF84: cl_settempdir (others.c:360)
==71752== by 0x804D634: clamd (clamd.c:247)
==71752== by 0x804CAB8: main (options.c:114)
==71752==
==71752==
==71752== 72 bytes in 1 blocks are still reachable in loss record 3 of 26
==71752== at 0x3C040F63: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C059E02: zzip_dir_alloc_ext_io (zzip-zip.c:510)
==71752== by 0x3C059FE2: zzip_dir_fdopen_ext_io (zzip-zip.c:596)
==71752== by 0x3C059FB8: zzip_dir_fdopen (zzip-zip.c:580)
==71752== by 0x3C05364F: cli_scanzip (scanners.c:282)
==71752== by 0x3C056665: cli_magic_scandesc (scanners.c:1382)
==71752== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==71752== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==71752== by 0x8050247: dirscan (scanner.c:156)
==71752==
==71752==
==71752== 88 bytes in 1 blocks are still reachable in loss record 4 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C13A2D3: setenv (setenv.c:86)
==71752== by 0x3C103B31: putenv (putenv.c:57)
==71752== by 0x3C04DFAE: cl_settempdir (others.c:362)
==71752== by 0x804D634: clamd (clamd.c:247)
==71752== by 0x804CAB8: main (options.c:114)
==71752==
==71752==
==71752== 108 bytes in 1 blocks are still reachable in loss record 5 of 26
==71752== at 0x3C040F63: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C057D2F: zzip_file_open (zzip-file.c:210)
==71752== by 0x3C053BA9: cli_scanzip (scanners.c:424)
==71752== by 0x3C056665: cli_magic_scandesc (scanners.c:1382)
==71752== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==71752== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==71752== by 0x8050247: dirscan (scanner.c:156)
==71752== by 0x805068C: scan (scanner.c:251)
==71752== by 0x804E144: command (session.c:84)
==71752==
==71752==
==71752== 157 bytes in 1 blocks are still reachable in loss record 6 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C059B12: __zzip_parse_root_directory (zzip-zip.c:355)
==71752== by 0x3C05A10E: __zzip_dir_parse (zzip-zip.c:643)
==71752== by 0x3C05A007: zzip_dir_fdopen_ext_io (zzip-zip.c:600)
==71752== by 0x3C059FB8: zzip_dir_fdopen (zzip-zip.c:580)
==71752== by 0x3C05364F: cli_scanzip (scanners.c:282)
==71752== by 0x3C056665: cli_magic_scandesc (scanners.c:1382)
==71752== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==71752== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==71752==
==71752==
==71752== 200 bytes in 1 blocks are definitely lost in loss record 7 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C0C68C0: (within /usr/local/lib/valgrind/libpthread.so.1)
==71752== by 0x3C0C91A5: (within /usr/local/lib/valgrind/libpthread.so.1)
==71752== by 0x3C0C9331: pthread_key_create (in /usr/local/lib/valgrind/libpthread.so.1)
==71752== by 0x3C0CA072: (within /usr/local/lib/valgrind/libpthread.so.1)
==71752== by 0x3C0C7818: pthread_create (in /usr/local/lib/valgrind/libpthread.so.1)
==71752== by 0x804EC6E: thrmgr_dispatch (thrmgr.c:248)
==71752== by 0x804FC0A: acceptloop_th (server-th.c:528)
==71752== by 0x804DFC7: localserver (localserver.c:108)
==71752==
==71752==
==71752== 260 bytes in 12 blocks are still reachable in loss record 8 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C0C68C0: (within /usr/local/lib/valgrind/libpthread.so.1)
==71752== by 0x3C0C7F3D: pthread_mutex_init (in /usr/local/lib/valgrind/libpthread.so.1)
==71752== by 0x3C0C7F9C: pthread_mutex_lock (in /usr/local/lib/valgrind/libpthread.so.1)
==71752== by 0x804A320: logg (output.c:116)
==71752== by 0x804D20A: clamd (clamd.c:144)
==71752== by 0x804CAB8: main (options.c:114)
==71752==
==71752==
==71752== 400 bytes in 1 blocks are still reachable in loss record 9 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C18DEDF: ??? (y.tab.c:308)
==71752== by 0x3C18E00F: _nsyyparse (y.tab.c:371)
==71752== by 0x3C19174F: ??? (nsdispatch.c:353)
==71752== by 0x3C191F3B: _nsdispatch (nsdispatch.c:595)
==71752== by 0x3C1633A7: getpwnam_r (getpwent.c:303)
==71752== by 0x3C163657: ??? (getpwent.c:401)
==71752== by 0x3C163576: ??? (getpwent.c:377)
==71752== by 0x3C163701: getpwnam (getpwent.c:427)
==71752==
==71752==
==71752== 784 bytes in 30 blocks are still reachable in loss record 10 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C040FDC: realloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C1913BF: ??? (nsdispatch.c:193)
==71752== by 0x3C191599: _nsdbtaddsrc (nsdispatch.c:269)
==71752== by 0x3C18DE36: ??? (nsparser.y:177)
==71752== by 0x3C18E3C5: _nsyyparse (nsparser.y:113)
==71752== by 0x3C19174F: ??? (nsdispatch.c:353)
==71752== by 0x3C191F3B: _nsdispatch (nsdispatch.c:595)
==71752== by 0x3C1633A7: getpwnam_r (getpwent.c:303)
==71752==
==71752==
==71752== 800 bytes in 1 blocks are still reachable in loss record 11 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C18DF57: ??? (y.tab.c:314)
==71752== by 0x3C18E00F: _nsyyparse (y.tab.c:371)
==71752== by 0x3C19174F: ??? (nsdispatch.c:353)
==71752== by 0x3C191F3B: _nsdispatch (nsdispatch.c:595)
==71752== by 0x3C1633A7: getpwnam_r (getpwent.c:303)
==71752== by 0x3C163657: ??? (getpwent.c:401)
==71752== by 0x3C163576: ??? (getpwent.c:377)
==71752== by 0x3C163701: getpwnam (getpwent.c:427)
==71752==
==71752==
==71752== 840 bytes in 42 blocks are still reachable in loss record 12 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C1A4005: telldir (telldir.c:68)
==71752== by 0x3C1A33D4: __opendir2 (opendir.c:277)
==71752== by 0x3C1A2DA4: opendir (opendir.c:62)
==71752== by 0x804FFDE: dirscan (scanner.c:118)
==71752== by 0x805068C: scan (scanner.c:251)
==71752== by 0x804E144: command (session.c:84)
==71752== by 0x804ED7A: scanner_thread (server-th.c:88)
==71752== by 0x804EB21: thrmgr_worker (thrmgr.c:199)
==71752==
==71752==
==71752== 1024 bytes in 1 blocks are still reachable in loss record 13 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C163521: ??? (getpwent.c:371)
==71752== by 0x3C163701: getpwnam (getpwent.c:427)
==71752== by 0x804D441: clamd (clamd.c:203)
==71752== by 0x804CAB8: main (options.c:114)
==71752==
==71752==
==71752== 1066 bytes in 2 blocks are still reachable in loss record 14 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C18F861: ??? (stdout:1675)
==71752== by 0x3C18F460: _nsyy_create_buffer (stdout:1350)
==71752== by 0x3C18E6AF: _nsyylex (stdout:677)
==71752== by 0x3C18E078: _nsyyparse (y.tab.c:380)
==71752== by 0x3C19174F: ??? (nsdispatch.c:353)
==71752== by 0x3C191F3B: _nsdispatch (nsdispatch.c:595)
==71752== by 0x3C1633A7: getpwnam_r (getpwent.c:303)
==71752== by 0x3C163657: ??? (getpwent.c:401)
==71752==
==71752==
==71752== 1324 bytes in 54 blocks are still reachable in loss record 15 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x804C47C: mmalloc (memory.c:27)
==71752== by 0x804B31F: regcfg (cfgparser.c:285)
==71752== by 0x804ACA6: parsecfg (cfgparser.c:155)
==71752== by 0x804D04C: clamd (clamd.c:106)
==71752== by 0x804CAB8: main (options.c:114)
==71752==
==71752==
==71752== 1574 bytes in 98 blocks are still reachable in loss record 16 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C1A0025: strdup (strdup.c:52)
==71752== by 0x3C18E90C: _nsyylex (nslexer.l:88)
==71752== by 0x3C18E078: _nsyyparse (y.tab.c:380)
==71752== by 0x3C19174F: ??? (nsdispatch.c:353)
==71752== by 0x3C191F3B: _nsdispatch (nsdispatch.c:595)
==71752== by 0x3C1633A7: getpwnam_r (getpwent.c:303)
==71752== by 0x3C163657: ??? (getpwent.c:401)
==71752== by 0x3C163576: ??? (getpwent.c:377)
==71752==
==71752==
==71752== 1754 bytes in 29 blocks are still reachable in loss record 17 of 26
==71752== at 0x3C040F63: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x804C4CA: mcalloc (memory.c:40)
==71752== by 0x804C8D7: main (options.c:66)
==71752==
==71752==
==71752== 2016 bytes in 42 blocks are still reachable in loss record 18 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C1A2EB2: __opendir2 (opendir.c:96)
==71752== by 0x3C1A2DA4: opendir (opendir.c:62)
==71752== by 0x804FFDE: dirscan (scanner.c:118)
==71752== by 0x805068C: scan (scanner.c:251)
==71752== by 0x804E144: command (session.c:84)
==71752== by 0x804ED7A: scanner_thread (server-th.c:88)
==71752== by 0x804EB21: thrmgr_worker (thrmgr.c:199)
==71752== by 0x3C0C7686: (within /usr/local/lib/valgrind/libpthread.so.1)
==71752==
==71752==
==71752== 6364 bytes in 14 blocks are still reachable in loss record 19 of 26
==71752== at 0x3C04105B: realloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C04DEC1: cli_realloc (others.c:336)
==71752== by 0x3C060221: messageAddArgument (message.c:408)
==71752== by 0x3C05E722: parseMimeHeader (mbox.c:3055)
==71752== by 0x3C05C022: parseEmailHeader (mbox.c:1410)
==71752== by 0x3C05C82D: parseEmailBody (mbox.c:1813)
==71752== by 0x3C05B365: cli_parse_mbox (mbox.c:930)
==71752== by 0x3C05AE7F: cli_mbox (mbox.c:694)
==71752== by 0x3C05628C: cli_scanmail (scanners.c:1305)
==71752==
==71752==
==71752== 32768 bytes in 1 blocks are still reachable in loss record 20 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C057D90: zzip_file_open (zzip-file.c:222)
==71752== by 0x3C053BA9: cli_scanzip (scanners.c:424)
==71752== by 0x3C056665: cli_magic_scandesc (scanners.c:1382)
==71752== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==71752== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==71752== by 0x8050247: dirscan (scanner.c:156)
==71752== by 0x805068C: scan (scanner.c:251)
==71752== by 0x804E144: command (session.c:84)
==71752==
==71752==
==71752== 55179 bytes in 3146 blocks are still reachable in loss record 21 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C052E36: cli_strtok (str.c:247)
==71752== by 0x804AB54: parsecfg (cfgparser.c:139)
==71752== by 0x804D04C: clamd (clamd.c:106)
==71752== by 0x804CAB8: main (options.c:114)
==71752==
==71752==
==71752== 147456 bytes in 9 blocks are still reachable in loss record 22 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C1BD0DE: __smakebuf (makebuf.c:74)
==71752== by 0x3C1BD007: __swsetup (wsetup.c:84)
==71752== by 0x3C1B5FC8: __vfprintf (vfprintf.c:645)
==71752== by 0x3C1B5F28: vfprintf (vfprintf.c:405)
==71752== by 0x804A6A7: logg (output.c:179)
==71752== by 0x804D20A: clamd (clamd.c:144)
==71752== by 0x804CAB8: main (options.c:114)
==71752==
==71752==
==71752== 172032 bytes in 42 blocks are still reachable in loss record 23 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C1A3383: __opendir2 (opendir.c:262)
==71752== by 0x3C1A2DA4: opendir (opendir.c:62)
==71752== by 0x804FFDE: dirscan (scanner.c:118)
==71752== by 0x805068C: scan (scanner.c:251)
==71752== by 0x804E144: command (session.c:84)
==71752== by 0x804ED7A: scanner_thread (server-th.c:88)
==71752== by 0x804EB21: thrmgr_worker (thrmgr.c:199)
==71752== by 0x3C0C7686: (within /usr/local/lib/valgrind/libpthread.so.1)
==71752==
==71752==
==71752== 831908 bytes in 29711 blocks are still reachable in loss record 24 of 26
==71752== at 0x3C040F63: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C04F391: cli_parse_add (readdb.c:383)
==71752== by 0x3C04F780: cli_loaddb (readdb.c:479)
==71752== by 0x3C050AFA: cl_loaddb (readdb.c:906)
==71752== by 0x3C050F79: cl_loaddbdir (readdb.c:994)
==71752== by 0x3C052680: cli_cvdload (cvd.c:426)
==71752== by 0x3C050B63: cl_loaddb (readdb.c:914)
==71752== by 0x3C050F79: cl_loaddbdir (readdb.c:994)
==71752== by 0x804D6D8: clamd (clamd.c:260)
==71752==
==71752==
==71752== 6381613 bytes in 76477 blocks are still reachable in loss record 25 of 26
==71752== at 0x3C040F63: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C04DE55: cli_calloc (others.c:321)
==71752== by 0x3C04E63B: cli_ac_addsig (readdb.c:71)
==71752== by 0x3C04F29A: cli_parse_add (readdb.c:367)
==71752== by 0x3C04F780: cli_loaddb (readdb.c:479)
==71752== by 0x3C050AFA: cl_loaddb (readdb.c:906)
==71752== by 0x3C050F79: cl_loaddbdir (readdb.c:994)
==71752== by 0x3C052680: cli_cvdload (cvd.c:426)
==71752== by 0x3C050B63: cl_loaddb (readdb.c:914)
==71752==
==71752==
==71752== 12482134 bytes in 332365 blocks are still reachable in loss record 26 of 26
==71752== at 0x3C04070F: malloc (in /usr/local/lib/valgrind/vgpreload_memcheck.so)
==71752== by 0x3C04DDC6: cli_malloc (others.c:301)
==71752== by 0x3C060D46: messageAddStr (message.c:857)
==71752== by 0x3C05B1BB: cli_parse_mbox (mbox.c:884)
==71752== by 0x3C05AE7F: cli_mbox (mbox.c:694)
==71752== by 0x3C05628C: cli_scanmail (scanners.c:1305)
==71752== by 0x3C056801: cli_magic_scandesc (scanners.c:1409)
==71752== by 0x3C056E9F: cl_scandesc (scanners.c:1538)
==71752== by 0x3C056F9A: cl_scanfile (scanners.c:1564)
==71752==
==71752== LEAK SUMMARY:
==71752== definitely lost: 229 bytes in 2 blocks.
==71752== possibly lost: 0 bytes in 0 blocks.
==71752== still reachable: 20121750 bytes in 442082 blocks.
==71752== suppressed: 0 bytes in 0 blocks.
--71752-- TT/TC: 0 tc sectors discarded.
--71752-- 8553 chainings, 0 unchainings.
--71752-- translate: new 9825 (171863 -> 2176286; ratio 126:10)
--71752-- discard 0 (0 -> 0; ratio 0:10).
--71752-- dispatch: 1395710330 jumps (bb entries), of which 111911647 (8%) were unchained.
--71752-- 66592/1838649 major/minor sched events. 231491 tt_fast misses.
--71752-- reg-alloc: 1720 t-req-spill, 387784+12659 orig+spill uis, 48565 total-reg-r.
--71752-- sanity: 66142 cheap, 2646 expensive checks.
--71752-- ccalls: 43323 C calls, 54% saves+restores avoided (139230 bytes)
--71752-- 58935 args, avg 0.89 setup instrs each (12102 bytes)
--71752-- 0% clear the stack (129969 bytes)
--71752-- 19085 retvals, 25% of reg-reg movs avoided (9440 bytes)
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html

Reply via email to