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

Johan Gunnarsson johan.gunnarsson at gmail.com
Wed Aug 7 16:29:01 CEST 2019


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
> --
> 2.20.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list