[vlc-commits] upnp: Do not crash without an active interface on macOS
Marvin Scholz
git at videolan.org
Tue Dec 10 11:51:39 CET 2019
vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | 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"), &val)) {
returnValue = FromCFString((CFStringRef)val, kCFStringEncodingUTF8);
}
+ CFRelease(q);
}
- CFRelease(q);
CFRelease(session);
return returnValue;
More information about the vlc-commits
mailing list