bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-mailutils] Re: seems mailutils memory leaks


From: Kostik
Subject: [bug-mailutils] Re: seems mailutils memory leaks
Date: Wed, 14 Apr 2010 19:44:08 +0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.0

Kostik wrote:
>> 2. I think that in my application has memory leak. 
> And valgrind show about two more leaks:
> ---
> ==5922== 160 bytes in 1 blocks are definitely lost in loss record 23 of 26
> ==5922==    at 0x40237D8: malloc (vg_replace_malloc.c:195)
> ==5922==    by 0x8066AEF: mu_filter_iconv_create (filter_iconv.c:430)
> ==5922==    by 0x80593AF: mu_decode_filter (mutil.c:1331)
> ==5922==    by 0x805EBAE: mu_rfc2047_decode (rfc2047.c:163)
> ==5922==    by 0x8057051: mu_mimehdr_decode_param (mimehdr.c:430)
> ==5922==    by 0x805782C: mu_message_aget_decoded_attachment_name
> (mimehdr.c:636)

Seems this can be fixed by:
--- ./filter_iconv.c.orig       2010-04-14 19:17:01.901309613 +0400
+++ ./filter_iconv.c    2010-04-14 19:17:31.080363254 +0400
@@ -114,6 +114,7 @@
   s->buf = NULL;
   if (s->cd != (iconv_t) -1)
     iconv_close (s->cd);
+  free (s);
 }
---

> ==5922== 3,151 (40 direct, 3,111 indirect) bytes in 1 blocks are definitely
> lost in loss record 26 of 26
> ==5922==    at 0x4022BB5: calloc (vg_replace_malloc.c:418)
> ==5922==    by 0x804EC76: mu_filter_create (filter.c:210)
> ==5922==    by 0x805934F: mu_decode_filter (mutil.c:1324)
> ==5922==    by 0x805EBAE: mu_rfc2047_decode (rfc2047.c:163)
> ==5922==    by 0x8057051: mu_mimehdr_decode_param (mimehdr.c:430)
> ==5922==    by 0x805782C: mu_message_aget_decoded_attachment_name
> (mimehdr.c:636)

It seems more difficult problem for me:

In mutil.c is mu_decode_filter() function. That call mu_filter_create() and
in some case - mu_filter_iconv_create(). And return stream to
mu_rfc2047_decode() in rfc2047.c

It works well while it not call mu_filter_iconv_create().

I add some debug printf() and my log is:
---
filter created (in filter.c)
close filter stream (in rfc2047.c)
filter destroyed (in filter.c)
---
ok, memory is cleaned.


But if mu_filter_iconv_create() called:
---
filter created (in filter.c)
filter_iconv_created (in filter_iconv.c)
close filter stream (in rfc2047.c)
filter_iconv_destroy (in filter_iconv.c)
---
then cleaned only mu_filter_iconv_create() memory, mu_filter_create()
memory not cleaned, because filter destroy (in filter.c) never called.


=kostik



reply via email to

[Prev in Thread] Current Thread [Next in Thread]