Commit f98dfcb3 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

xspf: Fix a may-be freed input_item pointer usage.

parent d64628e7
...@@ -687,6 +687,7 @@ static bool parse_extension_node COMPLEX_INTERFACE ...@@ -687,6 +687,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
char *psz_title = NULL; char *psz_title = NULL;
char *psz_application = NULL; char *psz_application = NULL;
int i_node; int i_node;
bool b_release_input_item = false;
xml_elem_hnd_t *p_handler = NULL; xml_elem_hnd_t *p_handler = NULL;
input_item_t *p_new_input = NULL; input_item_t *p_new_input = NULL;
...@@ -740,7 +741,7 @@ static bool parse_extension_node COMPLEX_INTERFACE ...@@ -740,7 +741,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
{ {
input_item_AddSubItem( p_input_item, p_new_input ); input_item_AddSubItem( p_input_item, p_new_input );
p_input_item = p_new_input; p_input_item = p_new_input;
vlc_gc_decref( p_new_input ); b_release_input_item = true;
} }
free( psz_title ); free( psz_title );
} }
...@@ -775,6 +776,7 @@ static bool parse_extension_node COMPLEX_INTERFACE ...@@ -775,6 +776,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
{ {
msg_Err( p_demux, "invalid xml stream" ); msg_Err( p_demux, "invalid xml stream" );
FREE_ATT(); FREE_ATT();
if(b_release_input_item) vlc_gc_decref( p_new_input );
return false; return false;
} }
/* choose handler */ /* choose handler */
...@@ -785,6 +787,7 @@ static bool parse_extension_node COMPLEX_INTERFACE ...@@ -785,6 +787,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
{ {
msg_Err( p_demux, "unexpected element <%s>", psz_name ); msg_Err( p_demux, "unexpected element <%s>", psz_name );
FREE_ATT(); FREE_ATT();
if(b_release_input_item) vlc_gc_decref( p_new_input );
return false; return false;
} }
FREE_NAME(); FREE_NAME();
...@@ -802,6 +805,7 @@ static bool parse_extension_node COMPLEX_INTERFACE ...@@ -802,6 +805,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
else else
{ {
FREE_ATT(); FREE_ATT();
if(b_release_input_item) vlc_gc_decref( p_new_input );
return false; return false;
} }
} }
...@@ -815,6 +819,7 @@ static bool parse_extension_node COMPLEX_INTERFACE ...@@ -815,6 +819,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
{ {
msg_Err( p_demux, "invalid xml stream" ); msg_Err( p_demux, "invalid xml stream" );
FREE_ATT(); FREE_ATT();
if(b_release_input_item) vlc_gc_decref( p_new_input );
return false; return false;
} }
break; break;
...@@ -826,12 +831,14 @@ static bool parse_extension_node COMPLEX_INTERFACE ...@@ -826,12 +831,14 @@ static bool parse_extension_node COMPLEX_INTERFACE
{ {
msg_Err( p_demux, "invalid xml stream" ); msg_Err( p_demux, "invalid xml stream" );
FREE_ATT(); FREE_ATT();
if(b_release_input_item) vlc_gc_decref( p_new_input );
return false; return false;
} }
/* leave if the current parent node is terminated */ /* leave if the current parent node is terminated */
if( !strcmp( psz_name, psz_element ) ) if( !strcmp( psz_name, psz_element ) )
{ {
FREE_ATT(); FREE_ATT();
if(b_release_input_item) vlc_gc_decref( p_new_input );
return true; return true;
} }
/* there MUST have been a start tag for that element name */ /* there MUST have been a start tag for that element name */
...@@ -841,6 +848,7 @@ static bool parse_extension_node COMPLEX_INTERFACE ...@@ -841,6 +848,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
msg_Err( p_demux, "there's no open element left for <%s>", msg_Err( p_demux, "there's no open element left for <%s>",
psz_name ); psz_name );
FREE_ATT(); FREE_ATT();
if(b_release_input_item) vlc_gc_decref( p_new_input );
return false; return false;
} }
...@@ -857,10 +865,12 @@ static bool parse_extension_node COMPLEX_INTERFACE ...@@ -857,10 +865,12 @@ static bool parse_extension_node COMPLEX_INTERFACE
/* unknown/unexpected xml node */ /* unknown/unexpected xml node */
msg_Err( p_demux, "unexpected xml node %i", i_node ); msg_Err( p_demux, "unexpected xml node %i", i_node );
FREE_ATT(); FREE_ATT();
if(b_release_input_item) vlc_gc_decref( p_new_input );
return false; return false;
} }
FREE_NAME(); FREE_NAME();
} }
if(b_release_input_item) vlc_gc_decref( p_new_input );
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment