[vlc-devel] [PATCH] upnp: Fix potential race during tear down.

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Aug 7 16:41:06 CEST 2019


On Wed, Aug 7, 2019, at 4:29 PM, Johan Gunnarsson wrote:
> Den tis 6 aug. 2019 kl 15:24 skrev Hugo Beauzée-Luyssen <hugo at beauzee.fr>:
> >
> > If two threads call UpnpFinish at the same time (or more precisely, if a
> > 2nd thread calls UpnpFinish before the first one sets UpnpSdkInit to 0)
> > we can end up double releasing most libupnp resources
> > ---
> >  modules/services_discovery/upnp-wrapper.cpp | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/modules/services_discovery/upnp-wrapper.cpp b/modules/services_discovery/upnp-wrapper.cpp
> > index c001492f37..76ceb89a1b 100644
> > --- a/modules/services_discovery/upnp-wrapper.cpp
> > +++ b/modules/services_discovery/upnp-wrapper.cpp
> > @@ -119,8 +119,8 @@ void UpnpInstanceWrapper::release()
> >          p_delete = s_instance;
> >          s_instance = NULL;
> >      }
> > -    vlc_mutex_unlock( &s_lock );
> >      delete p_delete;
> > +    vlc_mutex_unlock( &s_lock );
> 
> Might as well convert to vlc::threads::mutex_locker now.
> 
> >  }
> >
> >  UpnpClient_Handle UpnpInstanceWrapper::handle() const

Yep that's a very valid point!

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list