If a directory was not valid UTF-8, convert_xml_special_chars() would
return NULL, we'd have no title to give to our node, and we'd use
freed memory when adding the next node to the list.
Ensure we give valid UTF-8 to convert_xml_special_chars()
Also ensure we give a title to our node in any case
#include <vlc_fs.h>
#include <vlc_url.h>
#include <vlc_strings.h>
+#include <vlc_charset.h>
enum
{
/* Add node to XSPF extension */
char *old_xspf_ext = p_sys->xspf_ext;
+ EnsureUTF8 (entry);
char *title = convert_xml_special_chars (entry);
- if (old_xspf_ext != NULL && title != NULL
+ if (old_xspf_ext != NULL
&& asprintf (&p_sys->xspf_ext, "%s <vlc:node title=\"%s\">\n",
- old_xspf_ext, title) == -1)
+ old_xspf_ext, title ? title : "?") == -1)
p_sys->xspf_ext = NULL;
free (old_xspf_ext);
free (title);