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 708751 - gupnp_device_info_list_dlna_device_class_identifier is broken
gupnp_device_info_list_dlna_device_class_identifier is broken
Status: RESOLVED FIXED
Product: GUPnP
Classification: Other
Component: gupnp
0.20.x
Other Linux
: Normal normal
: ---
Assigned To: GUPnP Maintainers
GUPnP Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-25 14:07 UTC by Mark Ryan
Modified: 2013-09-30 11:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Do not hand out libxml2-allocated strings (1.51 KB, patch)
2013-09-30 11:14 UTC, Jens Georg
none Details | Review
Do not hand out libxml2-allocated strings (1.66 KB, patch)
2013-09-30 11:16 UTC, Jens Georg
committed Details | Review

Description Mark Ryan 2013-09-25 14:07:13 UTC
It requires the caller to free the returned list of strings.  However, the strings are not allocated by glib.  Instead they are allocated by libxml2.  So to actually free the list correctly it would need to do something like, g_list_free_full(list, xmlFree), which is undocumented, inconsistent with other gupnp functions and would require the caller to link against libxml2.
Comment 1 Jens Georg 2013-09-29 11:56:09 UTC
Do we need the functionality of xmlNodeGetContent or can we just do g_strdup (node->content) instead?
Comment 2 Mark Ryan 2013-09-30 08:28:31 UTC
Looking at the code, at lot of the other functions in the same file call xml_util_get_child_element_content_glib which does a g_strdup on the value returned from xmlNodeGetContent.
Comment 3 Jens Georg 2013-09-30 08:51:15 UTC
Oh, indeed. That's a lot of copying though.
Comment 4 Mark Ryan 2013-09-30 09:03:13 UTC
Sure is.  Don't see any alternative really without changing the API.
Comment 5 Jens Georg 2013-09-30 11:14:11 UTC
Created attachment 256071 [details] [review]
Do not hand out libxml2-allocated strings

We can't use xml_util_get_child_element_content_glib as this early-exits and
we need to collect all values that can occur.
Comment 6 Jens Georg 2013-09-30 11:16:15 UTC
Created attachment 256072 [details] [review]
Do not hand out libxml2-allocated strings

New version of the patch that also omits entries with NULL content


We can't use xml_util_get_child_element_content_glib as this early-exits and
we need to collect all values that can occur.

On top of that, don't add empty list entries.
Comment 7 Mark Ryan 2013-09-30 11:23:32 UTC
Review of attachment 256072 [details] [review]:

Looks good to me.
Comment 8 Jens Georg 2013-09-30 11:37:30 UTC
Attachment 256072 [details] pushed as 7134af3 - Do not hand out libxml2-allocated strings