From 99a1d4ac58dbf405c5c4f168e0625aca28a6fb72 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 6 Jan 2011 19:08:15 +0000 Subject: [PATCH] Fix potential memory leak from calling WinHttpGetIEProxyConfigForCurrentUser (issue #160). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@154 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- libcef/browser_request_context.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libcef/browser_request_context.cc b/libcef/browser_request_context.cc index 09a4febd3..862f3cefa 100644 --- a/libcef/browser_request_context.cc +++ b/libcef/browser_request_context.cc @@ -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)