Re: [gdome] 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 gmail com
   MSN: barbieri gmail com
  ICQ#: 17249123
 Skype: gsbarbieri
Mobile: +55 (81) 9927 0010
 Phone:  +1 (347) 624 6296; 08122692 sip stanaphone com
   GPG: 0xB640E1A2 @ wwwkeys.pgp.net



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