GNOME Bugzilla – Bug 689094
Some fixes for DIDL_S parsing.
Last modified: 2019-02-22 05:57:49 UTC
First patch fixes a function that should return a value but does not. Second patch fixes a possible situation when xml_doc is freed to many times because of ignoring parsing failure. Also, it clears members of media collection when parsing of string fails after calling media_collection_new_from_string. Patches will follow.
Created attachment 229915 [details] [review] Fixes gupnp_didl_lite_parser_parse_didl. First one.
Created attachment 229916 [details] [review] Fixes some issues with reference counting and parsing. Second.
Created attachment 230015 [details] Test case I attached a file for which the critical message was displayed. Also, I ran Rygel with playlist item under debugger just to see how this file is processed. So, gupnp_didl_lite_parser_parse_didl_recursive creates a GUPnPXMLDoc and calls parse_elements, which calls itself recursively when processing containers. Everytime this function quits, it unrefs xml_doc. So, in case when document has a container the parse_elements is called twice and xml_doc is unreffed twice. Instead of doing xml_doc unreffing in parse_elements I moved it back to function where it was created to ensure ref/unref parity. Also, I added a check for return value of parse_elements when called recursive to avoid further parsing if there was an error. The another change I added to media collection was to clean itself when parsing failed. Thus by checking if there is no title and no author and no items we can be sure that parsing indeed failed.
Wonder why that didn't show in the media collection tests.