Fix potential memory leak from calling WinHttpGetIEProxyConfigForCurrentUser (issue #160).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@154 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-01-06 19:08:15 +00:00
parent 998d11188f
commit 99a1d4ac58
1 changed files with 12 additions and 4 deletions

View File

@ -72,10 +72,18 @@ void BrowserRequestContext::Init(
// slow resource loading on Windows we only use the system proxy resolver if
// auto-detection is unchecked.
WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config = {0};
if (WinHttpGetIEProxyConfigForCurrentUser(&ie_config) &&
ie_config.fAutoDetect == TRUE) {
proxy_service_ = net::ProxyService::CreateWithoutProxyResolver(
new ProxyConfigServiceNull(), NULL);
if (WinHttpGetIEProxyConfigForCurrentUser(&ie_config)) {
if (ie_config.fAutoDetect == TRUE) {
proxy_service_ = net::ProxyService::CreateWithoutProxyResolver(
new ProxyConfigServiceNull(), NULL);
}
if (ie_config.lpszAutoConfigUrl)
GlobalFree(ie_config.lpszAutoConfigUrl);
if (ie_config.lpszProxy)
GlobalFree(ie_config.lpszProxy);
if (ie_config.lpszProxyBypass)
GlobalFree(ie_config.lpszProxyBypass);
}
#endif // defined(OS_WIN)