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 721858 - g_content_type_get_mime_type does not indicate return value is to be free'd
g_content_type_get_mime_type does not indicate return value is to be free'd
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal minor
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-01-09 11:15 UTC by Steve Dodier
Modified: 2018-05-24 16:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch adding the appropriate string to the doc (442 bytes, patch)
2014-01-09 11:15 UTC, Steve Dodier
needs-work Details | Review

Description Steve Dodier 2014-01-09 11:15:51 UTC
Created attachment 265825 [details] [review]
Patch adding the appropriate string to the doc

g_content_type_get_mime_type duplicates an internal string but the documentation does not indicate that the return value must be free'd by the caller, hence leading to memory leaks.
Comment 1 Emmanuele Bassi (:ebassi) 2014-01-09 12:15:38 UTC
Review of attachment 265825 [details] [review]:

thanks for your patch, though that's not complete.

::: old/gcontenttype.c
@@ +383,3 @@
  * Gets the mime type for the content type, if one is registered.
  *
  * Returns: (allow-none): the registered mime type for the given @type,

we should add the (transfer full) annotation. even if it is automatic for char*, this would allow gtk-doc to add the hint directly in the documentation.
Comment 2 Steve Dodier 2014-04-10 22:20:16 UTC
Emmanuele,

Thanks for the comment. I'm afraid I don't know where/how to add this annotation -- I'd never heard of it! Can I please hand it over to you to update the patch?

Thanks!
Comment 3 GNOME Infrastructure Team 2018-05-24 16:11:41 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/811.