Download Firefox: WindowsMac OS X
logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: Fixes for libxml strings: msg#00010

Subject: Re: Fixes for libxml strings
On Wednesday 29 March 2006 00:11, ext Sameer Oak wrote:
> > ... replaced them with gdome_str_mkref_xml(), which will use xmlFree()
> > instead of g_free().
>
> ---
> Was it gdome_str_unref()?

Sorry, I don't understand what you mean.

gdome_str_unref() will call the unref function provided by the 
gdome_str_mkref*() functions.

If you use gdome_str_mkref(), no free() on ptr->str.

If you use gdome_str_mkref_own() or gdome_str_mkref_dup(), g_free( ptr->str ) 
will be used.

If you use gdome_str_mkref_xml(), xmlFree( ptr->str ) will be used.


Yes, they're different because libxml and glib uses different allocator and if 
you misuse them you can get things like double-free or memory leaks.



-- 
Gustavo Sverzut Barbieri
------------------------
Instituto Nokia de Tecnologia - INdT

Jabber: barbieri@xxxxxxxxx
   MSN: barbieri@xxxxxxxxx
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010
 Phone:  +1 (347) 624 6296; 08122692@xxxxxxxxxxxxxxxxxx
   GPG: 0xB640E1A2 @ wwwkeys.pgp.net


<Prev in Thread] Current Thread [Next in Thread>