diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-26 14:41:57 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-26 14:41:57 +0000 |
commit | 23092c81519c434eb8e451899000a769fd142855 (patch) | |
tree | 3581319ef68ef06830c66fbde12119e2e2165e82 /chrome/browser/geolocation | |
parent | 587325e0060ba38b574a3bc2b1296cf75dd2b7e2 (diff) | |
download | chromium_src-23092c81519c434eb8e451899000a769fd142855.zip chromium_src-23092c81519c434eb8e451899000a769fd142855.tar.gz chromium_src-23092c81519c434eb8e451899000a769fd142855.tar.bz2 |
Fix for 44892: use scoped_array to avoid leak
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48273 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation')
-rw-r--r-- | chrome/browser/geolocation/wifi_data_provider_win.cc | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/chrome/browser/geolocation/wifi_data_provider_win.cc b/chrome/browser/geolocation/wifi_data_provider_win.cc index 03f4ab1..2134d22 100644 --- a/chrome/browser/geolocation/wifi_data_provider_win.cc +++ b/chrome/browser/geolocation/wifi_data_provider_win.cc @@ -49,33 +49,33 @@ const int kNoChangePollingInterval = 120000; // 2 mins const int kTwoNoChangePollingInterval = 600000; // 10 mins // WlanOpenHandle -typedef DWORD (WINAPI *WlanOpenHandleFunction)(DWORD dwClientVersion, +typedef DWORD (WINAPI* WlanOpenHandleFunction)(DWORD dwClientVersion, PVOID pReserved, PDWORD pdwNegotiatedVersion, PHANDLE phClientHandle); // WlanEnumInterfaces -typedef DWORD (WINAPI *WlanEnumInterfacesFunction)( +typedef DWORD (WINAPI* WlanEnumInterfacesFunction)( HANDLE hClientHandle, PVOID pReserved, - PWLAN_INTERFACE_INFO_LIST *ppInterfaceList); + PWLAN_INTERFACE_INFO_LIST* ppInterfaceList); // WlanGetNetworkBssList -typedef DWORD (WINAPI *WlanGetNetworkBssListFunction)( +typedef DWORD (WINAPI* WlanGetNetworkBssListFunction)( HANDLE hClientHandle, - const GUID *pInterfaceGuid, + const GUID* pInterfaceGuid, const PDOT11_SSID pDot11Ssid, DOT11_BSS_TYPE dot11BssType, BOOL bSecurityEnabled, PVOID pReserved, - PWLAN_BSS_LIST *ppWlanBssList + PWLAN_BSS_LIST* ppWlanBssList ); // WlanFreeMemory -typedef VOID (WINAPI *WlanFreeMemoryFunction)(PVOID pMemory); +typedef VOID (WINAPI* WlanFreeMemoryFunction)(PVOID pMemory); // WlanCloseHandle -typedef DWORD (WINAPI *WlanCloseHandleFunction)(HANDLE hClientHandle, +typedef DWORD (WINAPI* WlanCloseHandleFunction)(HANDLE hClientHandle, PVOID pReserved); @@ -87,7 +87,7 @@ class WindowsWlanApi : public WifiDataProviderCommon::WlanApiInterface { static WindowsWlanApi* Create(); // WlanApiInterface - virtual bool GetAccessPointData(WifiData::AccessPointDataSet *data); + virtual bool GetAccessPointData(WifiData::AccessPointDataSet* data); private: // Takes ownership of the library handle. @@ -250,7 +250,7 @@ bool WindowsWlanApi::GetAccessPointData( DCHECK(wlan_handle); // Get the list of interfaces. WlanEnumInterfaces allocates interface_list. - WLAN_INTERFACE_INFO_LIST *interface_list = NULL; + WLAN_INTERFACE_INFO_LIST* interface_list = NULL; if ((*WlanEnumInterfaces_function_)(wlan_handle, NULL, &interface_list) != ERROR_SUCCESS) { return false; @@ -584,21 +584,21 @@ bool GetSystemDirectory(string16* path) { if (buffer_size == 0) { return false; } - char16 *buffer = new char16[buffer_size]; + scoped_array<char16> buffer(new char16[buffer_size]); // Return value excludes terminating NULL. - int characters_written = ::GetSystemDirectory(buffer, buffer_size); + int characters_written = ::GetSystemDirectory(buffer.get(), buffer_size); if (characters_written == 0) { return false; } - DCHECK(characters_written == buffer_size - 1); + DCHECK_EQ(buffer_size - 1, characters_written); - path->assign(buffer); - delete[] buffer; + path->assign(buffer.get(), characters_written); - if (path->at(path->length() - 1) != L'\\') { + if (*path->rbegin() != L'\\') { path->append(L"\\"); } + DCHECK_EQ(L'\\', *path->rbegin()); return true; } } // namespace |