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

- Fix potential use after free

- Fix segfault if there is no preparse and/or fetcher object
parent 132d6e2f
...@@ -143,22 +143,22 @@ int playlist_ThreadDestroy( playlist_t * p_playlist ) ...@@ -143,22 +143,22 @@ int playlist_ThreadDestroy( playlist_t * p_playlist )
// Kill preparser // Kill preparser
if( p_playlist->p_preparse ) if( p_playlist->p_preparse )
{ {
vlc_cond_signal( &p_playlist->p_preparse->object_wait ); vlc_object_kill( p_playlist->p_preparse );
vlc_thread_join( p_playlist->p_preparse );
free( p_playlist->p_preparse->pp_waiting ); free( p_playlist->p_preparse->pp_waiting );
vlc_object_detach( p_playlist->p_preparse );
vlc_object_destroy( p_playlist->p_preparse );
} }
vlc_thread_join( p_playlist->p_preparse );
vlc_object_detach( p_playlist->p_preparse );
vlc_object_destroy( p_playlist->p_preparse );
// Kill meta fetcher // Kill meta fetcher
if( p_playlist->p_fetcher ) if( p_playlist->p_fetcher )
{ {
vlc_cond_signal( &p_playlist->p_fetcher->object_wait ); vlc_object_kill( p_playlist->p_fetcher );
vlc_thread_join( p_playlist->p_fetcher );
free( p_playlist->p_fetcher->p_waiting ); free( p_playlist->p_fetcher->p_waiting );
vlc_object_detach( p_playlist->p_fetcher );
vlc_object_destroy( p_playlist->p_fetcher );
} }
vlc_thread_join( p_playlist->p_fetcher );
vlc_object_detach( p_playlist->p_fetcher );
vlc_object_destroy( p_playlist->p_fetcher );
// Wait for thread to complete // Wait for thread to complete
vlc_thread_join( p_playlist ); vlc_thread_join( p_playlist );
......
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