Oleg, delete line 214 in dm_imaputil.c which reads g_free(result).
I'll update svn. Oleg wrote: >>A good way to track this down: >>set dbmail.conf to trace_level=5. >>trigger the error. >>grep the syslog for the actual commands and put them in a file >>cat file | valgrind --leak-check=full ./dbmail-imapd -n >>that should give a good indication where in the code this problem arises. > > > OK. > I tried. My commands: > > 1 LOGIN "user" "password" > 2 SELECT "SENT" > 3 UID FETCH 41827,41861:41862,41870 (UID RFC822.SIZE FLAGS ENVELOPE > BODY.PEEK[HEADER.FIELDS (REFERENCES)]) > 4 LOGOUT > > And I get glibc error > I attach file with output from command: > valgrind --leak-check=full -v \ > --show-reachable=yes /usr/local/sbin/dbmail-imapd -n > > Give me instructions, how can I help you > > > > ------------------------------------------------------------------------ > > ==8979== Memcheck, a memory error detector. > ==8979== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al. > ==8979== Using LibVEX rev 1367, a library for dynamic binary translation. > ==8979== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP. > ==8979== Using valgrind-3.0.1, a dynamic binary instrumentation framework. > ==8979== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al. > --8979-- Valgrind library directory: /usr/lib/valgrind > --8979-- Command line > --8979-- /usr/local/sbin/dbmail-imapd > --8979-- -n > --8979-- Startup, with flags: > --8979-- --leak-check=full > --8979-- -v > --8979-- --show-reachable=yes > --8979-- Contents of /proc/version: > --8979-- Linux version 2.6.14 ([EMAIL PROTECTED]) (gcc version 3.3.6) #5 > PREEMPT Fri Oct 28 10:07:10 MSD 2005 > --8979-- Reading syms from /usr/local/sbin/dbmail-imapd (0x8048000) > --8979-- Reading syms from /lib/ld-2.3.5.so (0x1B8E4000) > --8979-- Reading syms from /usr/lib/valgrind/stage2 (0xB0000000) > --8979-- Reading suppressions file: /usr/lib/valgrind/default.supp > ==8979== > --8979-- Reading syms from /usr/lib/valgrind/vg_preload_core.so (0x1B8FB000) > --8979-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck.so > (0x1B8FD000) > --8979-- REDIR: 0x1B8F4620 (index) redirected to 0x1B900220 (index) > --8979-- REDIR: 0x1B8F47D0 (strlen) redirected to 0x1B900490 (strlen) > --8979-- Reading syms from /usr/local/lib/dbmail/libsqldbmail.so.0.0.0 > (0x1B903000) > --8979-- Reading syms from /usr/lib/mysql/libmysqlclient.so.14.0.0 > (0x1B91F000) > --8979-- object doesn't have a symbol table > --8979-- Reading syms from /lib/tls/libcrypt-2.3.5.so (0x1BA3B000) > --8979-- Reading syms from /lib/tls/libm-2.3.5.so (0x1BA69000) > --8979-- Reading syms from /usr/local/lib/libgmime-2.0.so.2.1.15 (0x1BA8C000) > --8979-- Reading syms from /usr/lib/libgmodule-2.0.so.0.600.6 (0x1BAD9000) > --8979-- object doesn't have a symbol table > --8979-- Reading syms from /lib/tls/libdl-2.3.5.so (0x1BADE000) > --8979-- Reading syms from /usr/lib/libgthread-2.0.so.0.600.6 (0x1BAE2000) > --8979-- object doesn't have a symbol table > --8979-- Reading syms from /lib/tls/libpthread-2.3.5.so (0x1BAE6000) > --8979-- DWARF2 CFI reader: unhandled CFI instruction 0:50 > --8979-- DWARF2 CFI reader: unhandled CFI instruction 0:50 > --8979-- Reading syms from /usr/lib/libz.so.1.2.3 (0x1BAF8000) > --8979-- object doesn't have a symbol table > --8979-- Reading syms from /lib/tls/libnsl-2.3.5.so (0x1BB0A000) > --8979-- Reading syms from /usr/lib/libgobject-2.0.so.0.600.6 (0x1BB20000) > --8979-- object doesn't have a symbol table > --8979-- Reading syms from /usr/lib/libglib-2.0.so.0.600.6 (0x1BB54000) > --8979-- object doesn't have a symbol table > --8979-- Reading syms from /lib/tls/libc-2.3.5.so (0x1BBD4000) > --8979-- DWARF2 CFI reader: unhandled CFI instruction 0:50 > --8979-- DWARF2 CFI reader: unhandled CFI instruction 0:50 > --8979-- REDIR: 0x1BC3BA40 (rindex) redirected to 0x1B9000E0 (rindex) > --8979-- REDIR: 0x1BC3B6D0 (strlen) redirected to 0x1B900470 (strlen) > --8979-- REDIR: 0x1BC35860 (malloc) redirected to 0x1B8FE85C (malloc) > --8979-- REDIR: 0x1BC35AB0 (realloc) redirected to 0x1B8FFBBA (realloc) > --8979-- REDIR: 0x1BC3B140 (strcmp) redirected to 0x1B900720 (strcmp) > --8979-- REDIR: 0x1BC36010 (calloc) redirected to 0x1B8FFB0F (calloc) > --8979-- REDIR: 0x1BC3CA90 (memcpy) redirected to 0x1B9007D0 (memcpy) > --8979-- REDIR: 0x1BC3C4F0 (memmove) redirected to 0x1B900C10 (memmove) > --8979-- REDIR: 0x1BC3AFD0 (index) redirected to 0x1B9001F0 (index) > --8979-- REDIR: 0x1BC3AE20 (strcat) redirected to 0x1B900280 (strcat) > --8979-- REDIR: 0x1BC359F0 (free) redirected to 0x1B8FF353 (free) > --8979-- REDIR: 0x1BC3B990 (strncpy) redirected to 0x1B900590 (strncpy) > --8979-- REDIR: 0x1BC3C330 (memchr) redirected to 0x1B9007A0 (memchr) > --8979-- REDIR: 0x1BC3D3C0 (rawmemchr) redirected to 0x1B900CA0 (rawmemchr) > --8979-- REDIR: 0x1BC3C580 (memset) redirected to 0x1B900BE0 (memset) > --8979-- REDIR: 0x1BC3B1D0 (strcpy) redirected to 0x1B9004D0 (strcpy) > --8979-- REDIR: 0x1BC3B8C0 (strncmp) redirected to 0x1B9006C0 (strncmp) > --8979-- REDIR: 0x1BC3D490 (strchrnul) redirected to 0x1B900C80 (strchrnul) > --8979-- REDIR: 0x1BC3C770 (stpcpy) redirected to 0x1B9009A0 (stpcpy) > --8979-- Reading syms from /lib/tls/libnss_files-2.3.5.so (0x1B908000) > ==8979== Invalid free() / delete / delete[] > ==8979== at 0x1B8FF3D0: free (vg_replace_malloc.c:235) > ==8979== by 0x1BB7E103: g_free (in /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BAA3135: g_mime_header_destroy (gmime-header.c:113) > ==8979== by 0x1BAAB238: g_mime_object_finalize (gmime-object.c:135) > ==8979== by 0x1BAA49DE: g_mime_message_finalize (gmime-message.c:185) > ==8979== by 0x1BB29CC8: (within /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x805AE58: dbmail_message_free (dbmail-message.c:157) > ==8979== by 0x8057859: _imap_cache_update (dbmail-imapsession.c:225) > ==8979== by 0x8058675: dbmail_imap_session_fetch_get_items > (dbmail-imapsession.c:709) > ==8979== by 0x805336C: _ic_fetch (imapcommands.c:1787) > ==8979== by 0x805442E: _ic_uid (imapcommands.c:2318) > ==8979== by 0x804CC71: IMAPClientHandler (imap4.c:321) > ==8979== Address 0x1BD43388 is 0 bytes inside a block of size 62 free'd > ==8979== at 0x1B8FF3D0: free (vg_replace_malloc.c:235) > ==8979== by 0x1BB7E103: g_free (in /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x804D457: imap_append_header_as_string (dm_imaputil.c:214) > ==8979== by 0x804E0F0: imap_get_envelope (dm_imaputil.c:646) > ==8979== by 0x8058697: dbmail_imap_session_fetch_get_items > (dbmail-imapsession.c:710) > ==8979== by 0x805336C: _ic_fetch (imapcommands.c:1787) > ==8979== by 0x805442E: _ic_uid (imapcommands.c:2318) > ==8979== by 0x804CC71: IMAPClientHandler (imap4.c:321) > ==8979== by 0x8069DA9: manage_start_cli_server (serverchild.c:411) > ==8979== by 0x8068D1B: StartCliServer (server.c:99) > ==8979== by 0x8055439: main (imapd.c:119) > --8979-- REDIR: 0x1BC3B780 (strnlen) redirected to 0x1B900430 (strnlen) > --8979-- Reading syms from /usr/lib/gconv/CP1251.so (0x1B914000) > --8979-- REDIR: 0x1B8F4BF0 (stpcpy) redirected to 0x1B900A60 (stpcpy) > --8979-- discard syms at 0x1B914000-0x1B918000 in /usr/lib/gconv/CP1251.so > due to munmap() > --8979-- discard syms at 0x1B908000-0x1B912000 in > /lib/tls/libnss_files-2.3.5.so due to munmap() > ==8979== > ==8979== ERROR SUMMARY: 3 errors from 1 contexts (suppressed: 46 from 3) > ==8979== > ==8979== 3 errors in context 1 of 1: > ==8979== Invalid free() / delete / delete[] > ==8979== at 0x1B8FF3D0: free (vg_replace_malloc.c:235) > ==8979== by 0x1BB7E103: g_free (in /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BAA3135: g_mime_header_destroy (gmime-header.c:113) > ==8979== by 0x1BAAB238: g_mime_object_finalize (gmime-object.c:135) > ==8979== by 0x1BAA49DE: g_mime_message_finalize (gmime-message.c:185) > ==8979== by 0x1BB29CC8: (within /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x805AE58: dbmail_message_free (dbmail-message.c:157) > ==8979== by 0x8057859: _imap_cache_update (dbmail-imapsession.c:225) > ==8979== by 0x8058675: dbmail_imap_session_fetch_get_items > (dbmail-imapsession.c:709) > ==8979== by 0x805336C: _ic_fetch (imapcommands.c:1787) > ==8979== by 0x805442E: _ic_uid (imapcommands.c:2318) > ==8979== by 0x804CC71: IMAPClientHandler (imap4.c:321) > ==8979== Address 0x1BD43388 is 0 bytes inside a block of size 62 free'd > ==8979== at 0x1B8FF3D0: free (vg_replace_malloc.c:235) > ==8979== by 0x1BB7E103: g_free (in /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x804D457: imap_append_header_as_string (dm_imaputil.c:214) > ==8979== by 0x804E0F0: imap_get_envelope (dm_imaputil.c:646) > ==8979== by 0x8058697: dbmail_imap_session_fetch_get_items > (dbmail-imapsession.c:710) > ==8979== by 0x805336C: _ic_fetch (imapcommands.c:1787) > ==8979== by 0x805442E: _ic_uid (imapcommands.c:2318) > ==8979== by 0x804CC71: IMAPClientHandler (imap4.c:321) > ==8979== by 0x8069DA9: manage_start_cli_server (serverchild.c:411) > ==8979== by 0x8068D1B: StartCliServer (server.c:99) > ==8979== by 0x8055439: main (imapd.c:119) > --8979-- > --8979-- supp: 3 index-not-intercepted-early-enough-HACK-2 > --8979-- supp: 41 dl_relocate_object > --8979-- supp: 2 strlen/*dl_map_object*(Cond) > ==8979== > ==8979== IN SUMMARY: 3 errors from 1 contexts (suppressed: 46 from 3) > ==8979== > ==8979== malloc/free: in use at exit: 90202 bytes in 450 blocks. > ==8979== malloc/free: 7261 allocs, 6814 frees, 5644763 bytes allocated. > ==8979== > ==8979== searching for pointers to 450 not-freed blocks. > ==8979== checked 1420940 bytes. > ==8979== > ==8979== > ==8979== 12 bytes in 6 blocks are still reachable in loss record 1 of 10 > ==8979== at 0x1B8FE8DB: malloc (vg_replace_malloc.c:149) > ==8979== by 0x805A9B7: build_args_array_ext (dbmail-imapsession.c:1693) > ==8979== by 0x804CB45: IMAPClientHandler (imap4.c:272) > ==8979== by 0x8069DA9: manage_start_cli_server (serverchild.c:411) > ==8979== by 0x8068D1B: StartCliServer (server.c:99) > ==8979== by 0x8055439: main (imapd.c:119) > ==8979== > ==8979== > ==8979== 250 bytes in 6 blocks are definitely lost in loss record 2 of 10 > ==8979== at 0x1B8FFB95: calloc (vg_replace_malloc.c:279) > ==8979== by 0x1BB7DFEE: g_malloc0 (in /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x80582A4: dbmail_imap_session_get_msginfo_range > (dbmail-imapsession.c:603) > ==8979== by 0x8053245: _ic_fetch (imapcommands.c:1764) > ==8979== by 0x805442E: _ic_uid (imapcommands.c:2318) > ==8979== by 0x804CC71: IMAPClientHandler (imap4.c:321) > ==8979== by 0x8069DA9: manage_start_cli_server (serverchild.c:411) > ==8979== by 0x8068D1B: StartCliServer (server.c:99) > ==8979== by 0x8055439: main (imapd.c:119) > ==8979== > ==8979== > ==8979== 800 bytes in 20 blocks are possibly lost in loss record 3 of 10 > ==8979== at 0x1B8FFB95: calloc (vg_replace_malloc.c:279) > ==8979== by 0x1BB7DFEE: g_malloc0 (in /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BB3B1F6: (within /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB3B555: (within /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB42AE1: g_type_init_with_debug_flags (in > /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB42C01: g_type_init (in /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BA97764: g_mime_init (gmime.c:52) > ==8979== by 0x805533E: main (imapd.c:72) > ==8979== > ==8979== > ==8979== 2332 bytes in 11 blocks are still reachable in loss record 4 of 10 > ==8979== at 0x1B8FFC75: realloc (vg_replace_malloc.c:306) > ==8979== by 0x1BB7E070: g_realloc (in /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BB26DC7: (within /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB26B97: (within /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB263BA: g_boxed_type_register_static (in > /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB25FE6: g_value_array_get_type (in > /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB31E5E: (within /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB42BB8: g_type_init_with_debug_flags (in > /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB42C01: g_type_init (in /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BA97764: g_mime_init (gmime.c:52) > ==8979== by 0x805533E: main (imapd.c:72) > ==8979== > ==8979== > ==8979== 2532 bytes in 63 blocks are still reachable in loss record 5 of 10 > ==8979== at 0x1B8FE8DB: malloc (vg_replace_malloc.c:149) > ==8979== by 0x1B8FFBFE: realloc (vg_replace_malloc.c:306) > ==8979== by 0x1BB7E070: g_realloc (in /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BB6603A: (within /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BB65E67: g_quark_from_static_string (in > /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BB42A71: g_type_init_with_debug_flags (in > /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB42C01: g_type_init (in /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BA97764: g_mime_init (gmime.c:52) > ==8979== by 0x805533E: main (imapd.c:72) > ==8979== > ==8979== > ==8979== 6826 bytes in 180 blocks are still reachable in loss record 6 of 10 > ==8979== at 0x1B8FFB95: calloc (vg_replace_malloc.c:279) > ==8979== by 0x1BB7DFEE: g_malloc0 (in /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BB3C6E1: (within /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB42B63: g_type_init_with_debug_flags (in > /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB42C01: g_type_init (in /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BA97764: g_mime_init (gmime.c:52) > ==8979== by 0x805533E: main (imapd.c:72) > ==8979== > ==8979== > ==8979== 16380 bytes in 3 blocks are indirectly lost in loss record 7 of 10 > ==8979== at 0x1B8FE8DB: malloc (vg_replace_malloc.c:149) > ==8979== by 0x1B932B5D: my_malloc (in > /usr/lib/mysql/libmysqlclient.so.14.0.0) > ==8979== by 0x1B935DBB: alloc_root (in > /usr/lib/mysql/libmysqlclient.so.14.0.0) > ==8979== by 0x1B954315: unpack_fields (in > /usr/lib/mysql/libmysqlclient.so.14.0.0) > ==8979== by 0x1B956431: (within /usr/lib/mysql/libmysqlclient.so.14.0.0) > ==8979== by 0x1B95661F: mysql_real_query (in > /usr/lib/mysql/libmysqlclient.so.14.0.0) > ==8979== by 0x1B9043F4: db_query (dbmysql.c:222) > ==8979== > ==8979== > ==8979== 16476 (96 direct, 16380 indirect) bytes in 1 blocks are definitely > lost in loss record 8 of 10 > ==8979== at 0x1B8FE8DB: malloc (vg_replace_malloc.c:149) > ==8979== by 0x1B932B5D: my_malloc (in > /usr/lib/mysql/libmysqlclient.so.14.0.0) > ==8979== by 0x1B95668D: mysql_store_result (in > /usr/lib/mysql/libmysqlclient.so.14.0.0) > ==8979== by 0x1B904400: db_query (dbmysql.c:229) > ==8979== > ==8979== > ==8979== 20094 bytes in 150 blocks are still reachable in loss record 9 of 10 > ==8979== at 0x1B8FE8DB: malloc (vg_replace_malloc.c:149) > ==8979== by 0x1BB7DF66: g_malloc (in /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BB6AA0E: g_hash_table_new_full (in > /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BB6A9E3: g_hash_table_new (in > /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BB65E89: g_quark_from_static_string (in > /usr/lib/libglib-2.0.so.0.600.6) > ==8979== by 0x1BB42A71: g_type_init_with_debug_flags (in > /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BB42C01: g_type_init (in /usr/lib/libgobject-2.0.so.0.600.6) > ==8979== by 0x1BA97764: g_mime_init (gmime.c:52) > ==8979== by 0x805533E: main (imapd.c:72) > ==8979== > ==8979== > ==8979== 40880 bytes in 10 blocks are still reachable in loss record 10 of 10 > ==8979== at 0x1B8FE8DB: malloc (vg_replace_malloc.c:149) > ==8979== by 0x1B938E0A: my_once_alloc (in > /usr/lib/mysql/libmysqlclient.so.14.0.0) > ==8979== by 0x1B93A598: (within /usr/lib/mysql/libmysqlclient.so.14.0.0) > ==8979== by 0x1B93A407: get_charset_by_csname (in > /usr/lib/mysql/libmysqlclient.so.14.0.0) > ==8979== by 0x1B955110: mysql_real_connect (in > /usr/lib/mysql/libmysqlclient.so.14.0.0) > ==8979== by 0x1B903FBF: db_connect (dbmysql.c:89) > ==8979== > ==8979== LEAK SUMMARY: > ==8979== definitely lost: 346 bytes in 7 blocks. > ==8979== indirectly lost: 16380 bytes in 3 blocks. > ==8979== possibly lost: 800 bytes in 20 blocks. > ==8979== still reachable: 72676 bytes in 420 blocks. > ==8979== suppressed: 0 bytes in 0 blocks. > --8979-- memcheck: sanity checks: 175 cheap, 8 expensive > --8979-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use > --8979-- memcheck: auxmaps: 0 searches, 0 comparisons > --8979-- memcheck: secondaries: 67 issued (4288k, 4M) > --8979-- memcheck: secondaries: 41 accessible and distinguished (2624k, 2M) > --8979-- tt/tc: 32178 tt lookups requiring 38329 probes > --8979-- tt/tc: 32178 fast-cache updates, 6 flushes > --8979-- translate: new 12406 (255959 -> 4203847; ratio 164:10) [0 scs] > --8979-- translate: dumped 0 (0 -> ??) > --8979-- translate: discarded 174 (3300 -> ??) > --8979-- scheduler: 8796025 jumps (bb entries). > --8979-- scheduler: 175/41863 major/minor sched events. > --8979-- sanity: 176 cheap, 8 expensive checks. > --8979-- exectx: 4999 lists, 4662 contexts (avg 0 per list) > --8979-- exectx: 13892 searches, 12037 full compares (866 per 1000) > --8979-- exectx: 1258 cmp2, 136 cmp4, 0 cmpAll > > > ------------------------------------------------------------------------ > > _______________________________________________ > Dbmail-dev mailing list > [email protected] > http://twister.fastxs.net/mailman/listinfo/dbmail-dev -- ________________________________________________________________ Paul Stevens paul at nfg.nl NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31 The Netherlands________________________________http://www.nfg.nl
