After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 564794 - Improve GLib Reference Manual
Improve GLib Reference Manual
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: docs
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2008-12-16 23:20 UTC by aggro
Modified: 2009-01-03 04:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description aggro 2008-12-16 23:20:34 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.
Comment 1 Frederic Peters 2008-12-16 23:25:11 UTC
Thanks for the bug report, I am reassigning it to glib as it is where the documentation is.  (and you should use g_free)