Re: [evolution-patches] Memory improvement for the tokens in camel_folder_summary.c



On Wed, 2006-07-26 at 10:40 +0000, Philip Van Hoof wrote:
> > gchar *str = NULL;
> > str = camel_header_msgid_decode (camel_header_raw_find (&h,
> > "content-id", NULL));
> > ci->id = token_add (str);
> > g_free (str);
> 
> This creates memory segmentation as the only time the string needs to
> be
> freed, is when it's already found in the tokens table.
> 
> This way, it will always be freed. That's the reason why the free
> happens in token_add (and why token_add is a static or implementation
> detail of camel-folder-summary.c). 

As pointed out in IRC, when a string that is not in static tokens table,
but, exists in pstring-table, this patch would leak that *string*.

Phillip: How about an updated patch with discussed changes? (by removing
camel_pstring_*)... which will more or less look like the current
implementation, however, saves some *g_strdups*.

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]