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

Fix race condition if multiple threads delete the same HTTP host

parent 40486dcf
......@@ -1150,15 +1150,19 @@ void httpd_HostDelete( httpd_host_t *host )
{
httpd_t *httpd = host->httpd;
int i;
bool delete = false;
vlc_mutex_lock( &httpd_mutex );
vlc_mutex_lock( &host->lock );
host->i_ref--;
if( host->i_ref == 0 )
{
vlc_cond_signal( &host->wait );
delete = true;
}
vlc_mutex_unlock( &host->lock );
if( host->i_ref > 0 )
if( !delete )
{
/* still used */
vlc_mutex_unlock( &httpd_mutex );
......
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