Commit 07bcca1d authored by Felix Paul Kühne's avatar Felix Paul Kühne

src/darwin: fix crash while accessing http content while no proxy is set

parent 18c00a38
...@@ -46,43 +46,45 @@ char *vlc_getProxyUrl(const char *url) ...@@ -46,43 +46,45 @@ char *vlc_getProxyUrl(const char *url)
CFNumberRef cfn_httpProxyOn = CFNumberRef cfn_httpProxyOn =
(CFNumberRef)CFDictionaryGetValue(proxies, (CFNumberRef)CFDictionaryGetValue(proxies,
kSCPropNetProxiesHTTPEnable); kSCPropNetProxiesHTTPEnable);
int i_httpProxyOn; if (cfn_httpProxyOn) {
CFNumberGetValue(cfn_httpProxyOn, kCFNumberIntType, &i_httpProxyOn); int i_httpProxyOn;
CFRelease(cfn_httpProxyOn); CFNumberGetValue(cfn_httpProxyOn, kCFNumberIntType, &i_httpProxyOn);
CFRelease(cfn_httpProxyOn);
if (i_httpProxyOn == 1) // http proxy is on if (i_httpProxyOn == 1) // http proxy is on
{ {
CFStringRef httpProxy = CFStringRef httpProxy =
(CFStringRef)CFDictionaryGetValue(proxies, (CFStringRef)CFDictionaryGetValue(proxies,
kSCPropNetProxiesHTTPProxy); kSCPropNetProxiesHTTPProxy);
if (httpProxy) { if (httpProxy) {
CFNumberRef cfn_httpProxyPort = CFNumberRef cfn_httpProxyPort =
(CFNumberRef)CFDictionaryGetValue(proxies, (CFNumberRef)CFDictionaryGetValue(proxies,
kSCPropNetProxiesHTTPPort); kSCPropNetProxiesHTTPPort);
int i_httpProxyPort; int i_httpProxyPort;
CFNumberGetValue(cfn_httpProxyPort, CFNumberGetValue(cfn_httpProxyPort,
kCFNumberIntType, kCFNumberIntType,
&i_httpProxyPort); &i_httpProxyPort);
CFRelease(cfn_httpProxyPort); CFRelease(cfn_httpProxyPort);
CFMutableStringRef outputURL = CFMutableStringRef outputURL =
CFStringCreateMutableCopy(kCFAllocatorDefault, CFStringCreateMutableCopy(kCFAllocatorDefault,
0, 0,
httpProxy); httpProxy);
if (i_httpProxyPort > 0) if (i_httpProxyPort > 0)
CFStringAppendFormat(outputURL, CFStringAppendFormat(outputURL,
NULL, NULL,
CFSTR(":%i"), CFSTR(":%i"),
i_httpProxyPort); i_httpProxyPort);
CFStringGetCString(outputURL, CFStringGetCString(outputURL,
proxy_url, proxy_url,
sizeof(proxy_url), sizeof(proxy_url),
kCFStringEncodingASCII); kCFStringEncodingASCII);
CFRelease(outputURL); CFRelease(outputURL);
}
CFRelease(httpProxy);
} }
CFRelease(httpProxy);
} }
CFRelease(proxies); CFRelease(proxies);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment