Aaron Stone | 1 Mar 2006 07:03
Gravatar

Re: Troubles: rev-1996 and 1997 - one failure on testimap

On Tue, 2006-02-28 at 19:02 -0500, Leif Jackson wrote:
> On Tue, February 28, 2006 5:54 pm, Leif Jackson wrote:
> >
> > I belive I have come up with a fix for this and I have also found a few
> > extra possible memory leaks, I will submit a patch for your review here in
> > a bit
> 
> what i tried didn't quite workout right so Aaron if you have some ideas go
> for it I will keep hacking as well, but I have to get back to another
> project.

The use of g_strfreev here (ironically, for the out-of-memory cases) is
unsafe because strfreev tries to free the array itself -- but the_args
is static! So I replaced that with a little function to do the same, and
do it at the top of every call to build_args_array_ext. The only leak
left appears to be this:

==23026==
 843 bytes in 12 blocks are definitely lost in loss record 16 of 23
    at 0x1B905E6A: calloc (vg_replace_malloc.c:176)
    by 0x1BA5FE1E: g_malloc0 (in /usr/lib/libglib-2.0.so.0.800.5)
    by 0x804D8A9: IMAPClientHandler (imap4.c:269)
    by 0x1B9475EB: manage_start_cli_server (serverchild.c:373)
    by 0x1B94613C: StartCliServer (server.c:102)
    by 0x8055270: main (imapd.c:119)

The best I can figure is that it's leaking a list, because the only line
of code in all of DBMail that calls g_malloc0 is dm_list_nodeadd.

Aaron

Gmane