diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-08 17:38:52 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-08 17:38:52 +0000 |
commit | 999d7d8721fe1a0962de952dd9d2b6cdb5611517 (patch) | |
tree | ebfcc93040e40b51bb6a348f62030075241938c6 | |
parent | 4c491cc805aaf0cb53c645a4c077ed6d3e888595 (diff) | |
download | chromium_src-999d7d8721fe1a0962de952dd9d2b6cdb5611517.zip chromium_src-999d7d8721fe1a0962de952dd9d2b6cdb5611517.tar.gz chromium_src-999d7d8721fe1a0962de952dd9d2b6cdb5611517.tar.bz2 |
Fix a leak in wifi geolocation on the Mac
According to the comment in the reverse-engineered header, the returned arrays are allocated by the function, which would mean the client is responsible for freeing them.
BUG=None
TEST=Greener valgrind bots.
Review URL: http://codereview.chromium.org/4545002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65389 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/geolocation/wifi_data_provider_mac.cc | 7 | ||||
-rw-r--r-- | tools/valgrind/memcheck/suppressions_mac.txt | 13 |
2 files changed, 7 insertions, 13 deletions
diff --git a/chrome/browser/geolocation/wifi_data_provider_mac.cc b/chrome/browser/geolocation/wifi_data_provider_mac.cc index 804f9a6..fbac4cd 100644 --- a/chrome/browser/geolocation/wifi_data_provider_mac.cc +++ b/chrome/browser/geolocation/wifi_data_provider_mac.cc @@ -103,6 +103,7 @@ bool Apple80211Api::GetAccessPointData(WifiData::AccessPointDataSet* data) { DCHECK(WirelessScanSplit_function_); CFArrayRef managed_access_points = NULL; CFArrayRef adhoc_access_points = NULL; + // Arrays returned here are owned by the caller. WIErr err = (*WirelessScanSplit_function_)(wifi_context_, &managed_access_points, &adhoc_access_points, @@ -144,6 +145,12 @@ bool Apple80211Api::GetAccessPointData(WifiData::AccessPointDataSet* data) { } data->insert(access_point_data); } + + if (managed_access_points) + CFRelease(managed_access_points); + if (adhoc_access_points) + CFRelease(adhoc_access_points); + return true; } } // namespace diff --git a/tools/valgrind/memcheck/suppressions_mac.txt b/tools/valgrind/memcheck/suppressions_mac.txt index 1e0fc8d..90d361d 100644 --- a/tools/valgrind/memcheck/suppressions_mac.txt +++ b/tools/valgrind/memcheck/suppressions_mac.txt @@ -1143,16 +1143,3 @@ fun:createBitmapContext fun:CGBitmapContextCreate } -{ - bug_62346 - Memcheck:Leak - fun:malloc_zone_malloc - fun:_CFRuntimeCreateInstance - fun:__CFArrayInit - fun:CFArrayCreateCopy - obj:* - fun:_ZN12_GLOBAL__N_113Apple80211Api18GetAccessPointDataEPSt3setI15AccessPointData19AccessPointDataLessSaIS2_EE - fun:_ZN22WifiDataProviderCommon14DoWifiScanTaskEv - fun:_Z16DispatchToMethodI22WifiDataProviderCommonMS0_FvvEEvPT_T0_RK6Tuple0 - fun:_ZN27ScopedRunnableMethodFactoryI22WifiDataProviderCommonE14RunnableMethodIMS0_FvvE6Tuple0E3RunEv -} |