[vlc-commits] upnp: Do not crash without an active interface on macOS
vlc/vlc-3.0 | branch: master | Marvin Scholz | Tue Dec 10 11:58:45 2019 +0100| [bd391a39db694c5241e1c60ef63c70cbdaa999ed] | committer: Marvin Scholz upnp: Do not crash without an active interface on macOS (manually cherry-picked from 7000b96ea7ecea5109048913fcef4bc8af8ac143) Signed-off-by: Marvin Scholz > http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=bd391a39db694c5241e1c60ef63c70cbdaa999ed --- modules/services_discovery/upnp.cpp | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp index 4dc966738f..d51a533b47 100644 --- a/modules/services_discovery/upnp.cpp +++ b/modules/services_discovery/upnp.cpp @@ -1583,6 +1583,9 @@ inline char *FromCFString(const CFStringRef cfString, inline char *getPreferedAdapter() { SCDynamicStoreRef session = SCDynamicStoreCreate(NULL, CFSTR("session"), NULL, NULL); +if (session == NULL) +return NULL; + CFDictionaryRef q = (CFDictionaryRef) SCDynamicStoreCopyValue(session, CFSTR("State:/Network/Global/IPv4")); char *returnValue = NULL; @@ -1591,8 +1594,8 @@ inline char *getPreferedAdapter() if (CFDictionaryGetValueIfPresent(q, CFSTR("PrimaryInterface"), )) { returnValue = FromCFString((CFStringRef)val, kCFStringEncodingUTF8); } +CFRelease(q); } -CFRelease(q); CFRelease(session); return returnValue; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits
[vlc-commits] upnp: Do not crash without an active interface on macOS
vlc | branch: master | Marvin Scholz | Tue Dec 10 11:50:43 2019 +0100| [7000b96ea7ecea5109048913fcef4bc8af8ac143] | committer: Marvin Scholz upnp: Do not crash without an active interface on macOS > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7000b96ea7ecea5109048913fcef4bc8af8ac143 --- modules/services_discovery/upnp-wrapper.hpp | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/services_discovery/upnp-wrapper.hpp b/modules/services_discovery/upnp-wrapper.hpp index 4469b22ed6..643ce19245 100644 --- a/modules/services_discovery/upnp-wrapper.hpp +++ b/modules/services_discovery/upnp-wrapper.hpp @@ -345,6 +345,9 @@ done: inline char *getPreferedAdapter() { SCDynamicStoreRef session = SCDynamicStoreCreate(NULL, CFSTR("session"), NULL, NULL); +if (session == NULL) +return NULL; + CFDictionaryRef q = (CFDictionaryRef) SCDynamicStoreCopyValue(session, CFSTR("State:/Network/Global/IPv4")); char *returnValue = NULL; @@ -353,8 +356,8 @@ inline char *getPreferedAdapter() if (CFDictionaryGetValueIfPresent(q, CFSTR("PrimaryInterface"), )) { returnValue = FromCFString((CFStringRef)val, kCFStringEncodingUTF8); } +CFRelease(q); } -CFRelease(q); CFRelease(session); return returnValue; ___ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits