Commit ef4a8635 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix use-after-free when the input is still in use by someone else (refs #1287).

Unfortunately, this does not really solve the problem as vlc_object_destroy can still return without actually deleting the object in case of a deadlock.
One could argue the deadlock is the problem rather than vlc_object_destroy implementation.
parent be6a13db
...@@ -272,23 +272,23 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item, ...@@ -272,23 +272,23 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
static void Destroy( input_thread_t *p_input, sout_instance_t **pp_sout ) static void Destroy( input_thread_t *p_input, sout_instance_t **pp_sout )
{ {
vlc_object_detach( p_input ); vlc_object_detach( p_input );
input_thread_private_t *priv = p_input->p;
if( pp_sout ) if( pp_sout )
*pp_sout = NULL; *pp_sout = NULL;
if( p_input->p->p_sout ) if( priv->p_sout )
{ {
if( pp_sout ) if( pp_sout )
*pp_sout = p_input->p->p_sout; *pp_sout = priv->p_sout;
else if( p_input->p->b_sout_keep ) else if( priv->b_sout_keep )
SoutKeep( p_input->p->p_sout ); SoutKeep( priv->p_sout );
else else
sout_DeleteInstance( p_input->p->p_sout ); sout_DeleteInstance( priv->p_sout );
} }
vlc_mutex_destroy( &p_input->p->lock_control );
free( p_input->p );
vlc_object_destroy( p_input ); vlc_object_destroy( p_input );
vlc_mutex_destroy( &priv->lock_control );
free( priv );
} }
/** /**
......
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