Re: Fixes for libxml strings
Gustavo Sverzut Barbieri <[email protected]> Wed, 29 Mar 2006 06:23:28 -0300
| Newsgroups | gmane.comp.gnome.gdome |
|---|---|
| Organization | INdT |
| Message-ID | <[email protected]> |
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: [email protected] MSN: [email protected] ICQ#: 17249123 Skype: gsbarbieri Mobile: +55 (81) 9927 0010 Phone: +1 (347) 624 6296; [email protected] GPG: 0xB640E1A2 @ wwwkeys.pgp.net