GNOME Bugzilla – Bug 564794
Improve GLib Reference Manual
Last modified: 2009-01-03 04:15:21 UTC
GLib Reference Manual at: http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html has for example this text: " g_strdup () gchar* g_strdup (const gchar *str); Duplicates a string. If str is NULL it returns NULL. The returned string should be freed when no longer needed. " I have seen code that frees the text with free() and I have seen code which uses g_free(). I think you should free it with g_free(), but I can't find a documentation anywhere that would confirm this. If a memory is required to be freed by the user, the documentation should tell which function should be used to free it. Possibly even mention what will happen if wrong function is used (e.g. "undefined behaviour"). Several other functions in the same document have the same problem, so g_strdup() is just one example.
Thanks for the bug report, I am reassigning it to glib as it is where the documentation is. (and you should use g_free)