[vlc-commits] upnp: Fix potential race during tear down.
Hugo Beauzée-Luyssen
git at videolan.org
Thu Aug 8 12:14:31 CEST 2019
vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Aug 8 11:53:20 2019 +0200| [cfe426a6803404edcf0fe99cfefe8a327c17a6a1] | committer: Hugo Beauzée-Luyssen
upnp: Fix potential race during tear down.
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
(cherry picked from commit 2873288c7c7b1f62f67ce41b1928b326019f7898)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=cfe426a6803404edcf0fe99cfefe8a327c17a6a1
---
modules/services_discovery/upnp.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index f1037c82c8..e3a6496b3e 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -1698,7 +1698,7 @@ UpnpInstanceWrapper *UpnpInstanceWrapper::get(vlc_object_t *p_obj, services_disc
void UpnpInstanceWrapper::release(bool isSd)
{
UpnpInstanceWrapper *p_delete = NULL;
- vlc_mutex_lock( &s_lock );
+ vlc_mutex_locker lock( &s_lock );
if ( isSd )
{
delete UpnpInstanceWrapper::p_server_list;
@@ -1709,7 +1709,6 @@ void UpnpInstanceWrapper::release(bool isSd)
p_delete = s_instance;
s_instance = NULL;
}
- vlc_mutex_unlock( &s_lock );
delete p_delete;
}
More information about the vlc-commits
mailing list