Huh, weird. I didn't recall that dm_list_free would free both the list
nodes and the memory each node points to. But ok, I guess it does!

Fixed in SVN.

Aaron

On Fri, 2006-02-17 at 00:05 +0300, Oleg Lapshin wrote:
> Hello
> 
> valgrind output:
> 
> x:/export/hda3/0TMP/dbmail-svn
> $ valgrind --leak-check=full -v  \
>                 --show-reachable=yes /usr/local/sbin/dbmail-lmtpd -n
> ==14890== Memcheck, a memory error detector.
> ==14890== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
> ==14890== Using LibVEX rev 1367, a library for dynamic binary translation.
> ==14890== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
> ==14890== Using valgrind-3.0.1, a dynamic binary instrumentation framework.
> ==14890== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
> --14890-- Valgrind library directory: /usr/lib/valgrind
> --14890-- Command line
> --14890--    /usr/local/sbin/dbmail-lmtpd
> --14890--    -n
> --14890-- Startup, with flags:
> --14890--    --leak-check=full
> --14890--    -v
> --14890--    --show-reachable=yes
> --14890-- Contents of /proc/version:
> --14890--   Linux version 2.6.15 ([EMAIL PROTECTED]) (gcc version 3.4.5) #7 
> PREEMPT Fri 
> Jan 20 12:42:50 MSK 2006
> --14890-- Reading syms from /usr/local/sbin/dbmail-lmtpd (0x8048000)
> --14890-- Reading syms from /lib/ld-2.3.6.so (0x1B8E4000)
> --14890-- Reading syms from /usr/lib/valgrind/stage2 (0xB0000000)
> --14890-- Reading suppressions file: /usr/lib/valgrind/default.supp
> ==14890==
> --14890-- Reading syms from /usr/lib/valgrind/vg_preload_core.so (0x1B8FC000)
> --14890-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck.so 
> (0x1B8FE000)
> --14890-- REDIR: 0x1B8F5CC0 (index) redirected to 0x1B901220 (index)
> --14890-- REDIR: 0x1B8F5E80 (strlen) redirected to 0x1B901490 (strlen)
> --14890-- Reading syms from /usr/local/lib/libdbmail.so.0.0.0 (0x1B91C000)
> --14890-- Reading syms from /usr/local/lib/dbmail/libmysql.so.0.0.0 
> (0x1B94D000)
> --14890-- Reading syms from /usr/lib/mysql/libmysqlclient.so.14.0.0 
> (0x1B952000)
> --14890--    object doesn't have a symbol table
> --14890-- Reading syms from /lib/tls/libm-2.3.6.so (0x1BA6E000)
> --14890-- Reading syms from /usr/local/lib/dbmail/libsort_sieve.so.0.0.0 
> (0x1BA91000)
> --14890-- Reading syms from /usr/local/lib/libsieve.so.1.0.5 (0x1BA97000)
> --14890--    object doesn't have a symbol table
> --14890-- Reading syms from /usr/local/lib/dbmail/libauth_sql.so.0.0.0 
> (0x1BACF000)
> --14890-- Reading syms from /usr/local/lib/libgmime-2.0.so.2.1.15 (0x1BAD7000)
> --14890-- Reading syms from /usr/lib/libgmodule-2.0.so.0.800.4 (0x1BB24000)
> --14890--    object doesn't have a symbol table
> --14890-- Reading syms from /lib/tls/libdl-2.3.6.so (0x1BB28000)
> --14890-- Reading syms from /usr/lib/libgthread-2.0.so.0.800.4 (0x1BB2C000)
> --14890--    object doesn't have a symbol table
> --14890-- Reading syms from /lib/tls/libpthread-2.3.6.so (0x1BB30000)
> --14890-- DWARF2 CFI reader: unhandled CFI instruction 0:50
> --14890-- DWARF2 CFI reader: unhandled CFI instruction 0:50
> --14890-- Reading syms from /usr/lib/libz.so.1.2.3 (0x1BB43000)
> --14890--    object doesn't have a symbol table
> --14890-- Reading syms from /lib/tls/libnsl-2.3.6.so (0x1BB55000)
> --14890-- Reading syms from /usr/lib/libgobject-2.0.so.0.800.4 (0x1BB6B000)
> --14890--    object doesn't have a symbol table
> --14890-- Reading syms from /usr/lib/libglib-2.0.so.0.800.4 (0x1BB9F000)
> --14890--    object doesn't have a symbol table
> --14890-- Reading syms from /lib/tls/libcrypt-2.3.6.so (0x1BC21000)
> --14890-- Reading syms from /lib/tls/libc-2.3.6.so (0x1BC4F000)
> --14890-- DWARF2 CFI reader: unhandled CFI instruction 0:50
> --14890-- DWARF2 CFI reader: unhandled CFI instruction 0:50
> --14890-- REDIR: 0x1BCBA040 (memset) redirected to 0x1B901BE0 (memset)
> --14890-- REDIR: 0x1BCBA560 (memcpy) redirected to 0x1B9017D0 (memcpy)
> --14890-- REDIR: 0x1BCB9470 (rindex) redirected to 0x1B9010E0 (rindex)
> --14890-- REDIR: 0x1BCB9090 (strlen) redirected to 0x1B901470 (strlen)
> --14890-- REDIR: 0x1BCB41B0 (malloc) redirected to 0x1B8FF85C (malloc)
> --14890-- REDIR: 0x1BCB47E0 (realloc) redirected to 0x1B900BBA (realloc)
> --14890-- REDIR: 0x1BCB8B20 (strcmp) redirected to 0x1B901720 (strcmp)
> --14890-- REDIR: 0x1BCB3E90 (calloc) redirected to 0x1B900B0F (calloc)
> --14890-- REDIR: 0x1BCB9FB0 (memmove) redirected to 0x1B901C10 (memmove)
> --14890-- REDIR: 0x1BCB89B0 (index) redirected to 0x1B9011F0 (index)
> --14890-- REDIR: 0x1BCB8800 (strcat) redirected to 0x1B901280 (strcat)
> --14890-- REDIR: 0x1BCB2090 (free) redirected to 0x1B900353 (free)
> --14890-- REDIR: 0x1BCB93B0 (strncpy) redirected to 0x1B901590 (strncpy)
> --14890-- REDIR: 0x1BCB9290 (strncmp) redirected to 0x1B9016C0 (strncmp)
> --14890-- REDIR: 0x1BCBA240 (stpcpy) redirected to 0x1B9019A0 (stpcpy)
> --14890-- REDIR: 0x1BCB8BB0 (strcpy) redirected to 0x1B9014D0 (strcpy)
> --14890-- REDIR: 0x1BCB9DF0 (memchr) redirected to 0x1B9017A0 (memchr)
> --14890-- REDIR: 0x1BCBAEB0 (strchrnul) redirected to 0x1B901C80 (strchrnul)
> --14890-- Reading syms from /lib/tls/libnss_files-2.3.6.so (0x1B903000)
> --14890-- REDIR: 0x1BCBADE0 (rawmemchr) redirected to 0x1B901CA0 (rawmemchr)
> mail220 fox DBMail LMTP service ready to rock
>  from: <[EMAIL PROTECTED]>
> 250 Sender <[EMAIL PROTECTED]> OK
> rcpt to: <[EMAIL PROTECTED]>
> 250 Recipient <[EMAIL PROTECTED]> OK
> data
> 354 Start mail input; end with <CRLF>.<CRLF>
> Subject: test
> 
> test
> ..
> --14890-- REDIR: 0x1BCB9140 (strnlen) redirected to 0x1B901430 (strnlen)
> 
> (process:14890): GLib-CRITICAL **: g_string_truncate: assertion `string != 
> NULL' failed
> 
> (process:14890): GLib-CRITICAL **: g_string_append_len: assertion `string != 
> NULL' failed
> ==14890== Invalid free() / delete / delete[]
> ==14890==    at 0x1B9003D0: free (vg_replace_malloc.c:235)
> ==14890==    by 0x1BBCA763: g_free (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1B92C5D6: dm_list_free (list.c:45)
> ==14890==    by 0x1B92C5CB: dm_list_free (list.c:42)
> ==14890==    by 0x1BA92B18: sort_teardown (sortsieve.c:365)
> ==14890==  Address 0x1BDF8450 is 0 bytes inside a block of size 4 free'd
> ==14890==    at 0x1B9003D0: free (vg_replace_malloc.c:235)
> ==14890==    by 0x1BA92B09: sort_teardown (sortsieve.c:363)
> ==14890==
> ==14890== Invalid free() / delete / delete[]
> ==14890==    at 0x1B9003D0: free (vg_replace_malloc.c:235)
> ==14890==    by 0x1BBCA763: g_free (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1B92C5D6: dm_list_free (list.c:45)
> ==14890==    by 0x1BA92B18: sort_teardown (sortsieve.c:365)
> ==14890==  Address 0x1BDFAD08 is 0 bytes inside a block of size 4 free'd
> ==14890==    at 0x1B9003D0: free (vg_replace_malloc.c:235)
> ==14890==    by 0x1BA92B09: sort_teardown (sortsieve.c:363)
> 215 Recipient <[EMAIL PROTECTED]> OK
> quit
> 221 fox BYE
> --14890-- discard syms at 0x1B903000-0x1B90E000 
> in /lib/tls/libnss_files-2.3.6.so due to munmap()
> ==14890==
> ==14890== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 52 from 3)
> ==14890==
> ==14890== 1 errors in context 1 of 2:
> ==14890== Invalid free() / delete / delete[]
> ==14890==    at 0x1B9003D0: free (vg_replace_malloc.c:235)
> ==14890==    by 0x1BBCA763: g_free (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1B92C5D6: dm_list_free (list.c:45)
> ==14890==    by 0x1BA92B18: sort_teardown (sortsieve.c:365)
> ==14890==  Address 0x1BDFAD08 is 0 bytes inside a block of size 4 free'd
> ==14890==    at 0x1B9003D0: free (vg_replace_malloc.c:235)
> ==14890==    by 0x1BA92B09: sort_teardown (sortsieve.c:363)
> ==14890==
> ==14890== 1 errors in context 2 of 2:
> ==14890== Invalid free() / delete / delete[]
> ==14890==    at 0x1B9003D0: free (vg_replace_malloc.c:235)
> ==14890==    by 0x1BBCA763: g_free (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1B92C5D6: dm_list_free (list.c:45)
> ==14890==    by 0x1B92C5CB: dm_list_free (list.c:42)
> ==14890==    by 0x1BA92B18: sort_teardown (sortsieve.c:365)
> ==14890==  Address 0x1BDF8450 is 0 bytes inside a block of size 4 free'd
> ==14890==    at 0x1B9003D0: free (vg_replace_malloc.c:235)
> ==14890==    by 0x1BA92B09: sort_teardown (sortsieve.c:363)
> --14890--
> --14890-- supp:    3 index-not-intercepted-early-enough-HACK-2
> --14890-- supp:   47 dl_relocate_object
> --14890-- supp:    2 strlen/*dl_map_object*(Cond)
> ==14890==
> ==14890== IN SUMMARY: 2 errors from 2 contexts (suppressed: 52 from 3)
> ==14890==
> ==14890== malloc/free: in use at exit: 75802 bytes in 454 blocks.
> ==14890== malloc/free: 3984 allocs, 3532 frees, 6373349 bytes allocated.
> ==14890==
> ==14890== searching for pointers to 454 not-freed blocks.
> ==14890== checked 1531720 bytes.
> ==14890==
> ==14890==
> ==14890== 8 bytes in 1 blocks are definitely lost in loss record 1 of 10
> ==14890==    at 0x1B8FF8DB: malloc (vg_replace_malloc.c:149)
> ==14890==    by 0x1BA92985: sort_getheader (sortsieve.c:289)
> ==14890==
> ==14890==
> ==14890== 30 bytes in 2 blocks are definitely lost in loss record 2 of 10
> ==14890==    at 0x1B8FF8DB: malloc (vg_replace_malloc.c:149)
> ==14890==    by 0x1B9367F0: find_bounded (misc.c:453)
> ==14890==    by 0x8049D9E: lmtp (lmtp.c:411)
> ==14890==    by 0x804A2A3: lmtp_handle_connection (lmtp.c:190)
> ==14890==    by 0x1B939D36: manage_start_cli_server (serverchild.c:410)
> ==14890==    by 0x1B938C86: StartCliServer (server.c:99)
> ==14890==    by 0x804AD85: main (lmtpd.c:126)
> ==14890==
> ==14890==
> ==14890== 800 bytes in 20 blocks are possibly lost in loss record 3 of 10
> ==14890==    at 0x1B900B95: calloc (vg_replace_malloc.c:279)
> ==14890==    by 0x1BBCA64E: g_malloc0 (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BB86B86: (within /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB86EE5: (within /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB8E471: g_type_init_with_debug_flags 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB8E591: g_type_init 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BAE2764: g_mime_init (gmime.c:52)
> ==14890==    by 0x804AB5E: main (lmtpd.c:75)
> ==14890==
> ==14890==
> ==14890== 1056 bytes in 5 blocks are definitely lost in loss record 4 of 10
> ==14890==    at 0x1B8FF8DB: malloc (vg_replace_malloc.c:149)
> ==14890==    by 0x1B900BFE: realloc (vg_replace_malloc.c:306)
> ==14890==    by 0x1BBCA6D0: g_realloc (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BBDD6D8: (within /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BBDD7B1: g_string_sized_new 
> (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BBDD88D: g_string_new (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1B926789: g_mime_object_get_body (dbmail-message.c:73)
> ==14890==    by 0x1B9270FF: dbmail_message_body_to_string 
> (dbmail-message.c:444)
> ==14890==    by 0x1B927141: dbmail_message_hdrs_to_string 
> (dbmail-message.c:451)
> ==14890==    by 0x1B93B510: insert_messages (pipe.c:460)
> ==14890==    by 0x8049EB7: lmtp (lmtp.c:619)
> ==14890==    by 0x804A2A3: lmtp_handle_connection (lmtp.c:190)
> ==14890==
> ==14890==
> ==14890== 1056 bytes in 5 blocks are definitely lost in loss record 5 of 10
> ==14890==    at 0x1B900C75: realloc (vg_replace_malloc.c:306)
> ==14890==    by 0x1BBCA6D0: g_realloc (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BBABB0C: (within /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BBAB710: g_array_set_size 
> (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BBAC42A: g_byte_array_set_size 
> (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BB01F09: stream_write (gmime-stream-mem.c:150)
> ==14890==    by 0x1BAFDF3B: g_mime_stream_write (gmime-stream.c:197)
> ==14890==    by 0x1BAFE616: g_mime_stream_write_string (gmime-stream.c:499)
> ==14890==    by 0x1BAF0AD2: message_write_to_stream (gmime-message.c:813)
> ==14890==    by 0x1BAF70AC: g_mime_object_write_to_stream (gmime-object.c:660)
> ==14890==    by 0x1BAF7179: g_mime_object_to_string (gmime-object.c:686)
> ==14890==    by 0x1B9270BF: dbmail_message_to_string (dbmail-message.c:440)
> ==14890==
> ==14890==
> ==14890== 2300 bytes in 11 blocks are still reachable in loss record 6 of 10
> ==14890==    at 0x1B900C75: realloc (vg_replace_malloc.c:306)
> ==14890==    by 0x1BBCA6D0: g_realloc (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BB720E7: (within /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB71EB7: (within /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB716DA: g_boxed_type_register_static 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB712B6: g_value_array_get_type 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB7D88E: (within /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB8E548: g_type_init_with_debug_flags 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB8E591: g_type_init 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BAE2764: g_mime_init (gmime.c:52)
> ==14890==    by 0x804AB5E: main (lmtpd.c:75)
> ==14890==
> ==14890==
> ==14890== 2548 bytes in 64 blocks are still reachable in loss record 7 of 10
> ==14890==    at 0x1B8FF8DB: malloc (vg_replace_malloc.c:149)
> ==14890==    by 0x1B900BFE: realloc (vg_replace_malloc.c:306)
> ==14890==    by 0x1BBCA6D0: g_realloc (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BBB18CA: (within /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BBB16F7: g_quark_from_static_string 
> (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BB8E401: g_type_init_with_debug_flags 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB8E591: g_type_init 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BAE2764: g_mime_init (gmime.c:52)
> ==14890==    by 0x804AB5E: main (lmtpd.c:75)
> ==14890==
> ==14890==
> ==14890== 6780 bytes in 175 blocks are still reachable in loss record 8 of 10
> ==14890==    at 0x1B900B95: calloc (vg_replace_malloc.c:279)
> ==14890==    by 0x1BBCA64E: g_malloc0 (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BB88071: (within /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB8E4F3: g_type_init_with_debug_flags 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB8E591: g_type_init 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BAE2764: g_mime_init (gmime.c:52)
> ==14890==    by 0x804AB5E: main (lmtpd.c:75)
> ==14890==
> ==14890==
> ==14890== 20344 bytes in 161 blocks are still reachable in loss record 9 of 10
> ==14890==    at 0x1B8FF8DB: malloc (vg_replace_malloc.c:149)
> ==14890==    by 0x1BBCA5C6: g_malloc (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BBB6B9E: g_hash_table_new_full 
> (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BBB6B73: g_hash_table_new 
> (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BBB1719: g_quark_from_static_string 
> (in /usr/lib/libglib-2.0.so.0.800.4)
> ==14890==    by 0x1BB8E401: g_type_init_with_debug_flags 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BB8E591: g_type_init 
> (in /usr/lib/libgobject-2.0.so.0.800.4)
> ==14890==    by 0x1BAE2764: g_mime_init (gmime.c:52)
> ==14890==    by 0x804AB5E: main (lmtpd.c:75)
> ==14890==
> ==14890==
> ==14890== 40880 bytes in 10 blocks are still reachable in loss record 10 of 10
> ==14890==    at 0x1B8FF8DB: malloc (vg_replace_malloc.c:149)
> ==14890==    by 0x1B96BE0A: my_once_alloc 
> (in /usr/lib/mysql/libmysqlclient.so.14.0.0)
> ==14890==    by 0x1B96D598: (within /usr/lib/mysql/libmysqlclient.so.14.0.0)
> ==14890==    by 0x1B96D407: get_charset_by_csname 
> (in /usr/lib/mysql/libmysqlclient.so.14.0.0)
> ==14890==    by 0x1B988110: mysql_real_connect 
> (in /usr/lib/mysql/libmysqlclient.so.14.0.0)
> ==14890==    by 0x1B94DF2E: db_connect (dbmysql.c:97)
> ==14890==
> ==14890== LEAK SUMMARY:
> ==14890==    definitely lost: 2150 bytes in 13 blocks.
> ==14890==      possibly lost: 800 bytes in 20 blocks.
> ==14890==    still reachable: 72852 bytes in 421 blocks.
> ==14890==         suppressed: 0 bytes in 0 blocks.
> --14890--  memcheck: sanity checks: 174 cheap, 7 expensive
> --14890--  memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use
> --14890--  memcheck: auxmaps: 0 searches, 0 comparisons
> --14890--  memcheck: secondaries: 89 issued (5696k, 5M)
> --14890--  memcheck: secondaries: 43 accessible and distinguished (2752k, 2M)
> --14890--     tt/tc: 31996 tt lookups requiring 38075 probes
> --14890--     tt/tc: 31996 fast-cache updates, 5 flushes
> --14890-- translate: new        12719 (265129 -> 4271407; ratio 161:10) [0 
> scs]
> --14890-- translate: dumped     0 (0 -> ??)
> --14890-- translate: discarded  125 (2116 -> ??)
> --14890-- scheduler: 8755076 jumps (bb entries).
> --14890-- scheduler: 174/27725 major/minor sched events.
> --14890--    sanity: 175 cheap, 7 expensive checks.
> --14890--    exectx: 4999 lists, 3284 contexts (avg 0 per list)
> --14890--    exectx: 7552 searches, 5372 full compares (711 per 1000)
> --14890--    exectx: 1318 cmp2, 147 cmp4, 0 cmpAll
> 
> 
> -- 
> Oleg Lapshin
> 
> _______________________________________________
> Dbmail-dev mailing list
> Dbmail-dev@dbmail.org
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Reply via email to