vlc/vlc-3.0 | branch: master | Marvin Scholz <epira...@gmail.com> | 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 <epira...@gmail.com> > 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"), &val)) { 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