Leif,

could you plz resent this patch as attachment? I can't get it to apply
like this.

You can simply do 'svn diff misc.c' to produce valid patches. No need to
keep an original tree around.

thanks,

Leif Jackson wrote:
> Just a suggestion :) I belive without closing it everywhere in that
> function there are still leaks from iconv.
> 
> -leif
> 
> diff -urN dbmail-svn-2.2.4-2480.leif2/misc.c
> dbmail-svn-2.2.4-2480.leif3/misc.c
> --- dbmail-svn-2.2.4-2480.leif2/misc.c  2007-03-24 18:40:07.000000000 -0400
> +++ dbmail-svn-2.2.4-2480.leif3/misc.c  2007-03-25 00:38:19.000000000 -0400
> @@ -2019,6 +2019,7 @@
> char * convert_8bit_field_to_utf8(GMimeMessage *message,const char* str_in)
> {
>        char * subj=NULL;
> +       int allocated_default_iconv = 0;
>        static iconv_t default_iconv=(iconv_t)-1;
>        static const char *default_charset=NULL;
>        const char *charset;
> @@ -2035,13 +2036,18 @@
>                default_iconv=g_mime_iconv_open("UTF-8",default_charset);
>                if (default_iconv == (iconv_t)-1) {
>                        TRACE(TRACE_DEBUG,"incorrect default encoding
> [%s]", default_charset);
> -               }
> +               }else
> +                       allocated_default_iconv = 1;
>        }
> 
> -       if (str_in==NULL)
> +       if (str_in==NULL) {
> +               if(allocated_default_iconv)
> g_mime_iconv_close(default_iconv);
>                return NULL;
> +       }
> +
>        if (g_utf8_validate((const gchar *)str_in, -1, NULL) ||
> !g_mime_utils_text_is_8bit((unsigned char *)str_in, strlen(str_in))) {
>                // Conversion not needed
> +               if(allocated_default_iconv)
> g_mime_iconv_close(default_iconv);
>                return g_strdup(str_in);
>        }
> 
> @@ -2058,13 +2064,11 @@
>                                TRACE(TRACE_DEBUG,"incorrect encoding
> [%s] base [UTF-8]", charset);
>                        } else {
>                                subj=g_mime_iconv_strdup(conv_iconv,str_in);
> -                               g_mime_iconv_close(conv_iconv);
>                        }
>                }
>        }
>        if (subj==NULL) {
>                subj=g_mime_iconv_strdup(default_iconv,str_in);
> -               g_mime_iconv_close(default_iconv);
>        }
> 
>        if (subj==NULL) {
> @@ -2075,6 +2079,9 @@
>                    if(*p & 0x80) *p='?';
>        }
> 
> +       if(allocated_default_iconv)
> +               g_mime_iconv_close(default_iconv);
> +
>        return subj;
> }
> 
> _______________________________________________
> 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
_______________________________________________
Dbmail-dev mailing list
[email protected]
http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Reply via email to