Re: [evolution-patches] Memory improvement for the tokens in camel_folder_summary.c
- From: "Veerapuram Varadhan" <vvaradhan novell com>
- To: <spam pvanhoof be>
- Cc: evolution-patches gnome org
- Subject: Re: [evolution-patches] Memory improvement for the tokens in camel_folder_summary.c
- Date: Wed, 26 Jul 2006 04:11:06 -0600
On Thu, 2006-07-20 at 20:30 +0000, Philip Van Hoof wrote:
> +
> +guint bytes;
> +static gchar*
> +token_add (gchar *str)
> +{
> + int i;
> +
> + if (!str)
> + return NULL;
> +
> + for (i=0; i<tokens_len; i++)
> + if (!strcmp (str, tokens[i]))
> + {
> + g_free (str);
> + return tokens[i];
> + }
Its not a good practice to *free* parameter-value inside token_add.
> + ci->id = token_add (camel_header_msgid_decode
> (camel_header_raw_find (&h, "content-id", NULL)));
A better way would be,
gchar *str = NULL;
str = camel_header_msgid_decode (camel_header_raw_find (&h,
"content-id", NULL));
ci->id = token_add (str);
g_free (str);
V. Varadhan
Novell, Inc.
Software for the Open Enterprise™
http://www.novell.com
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]