diff options
author | charliea <charliea@chromium.org> | 2015-10-02 07:37:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-02 14:38:40 +0000 |
commit | a23ea81113ce25986e2ee2632a4ad4aebed7460f (patch) | |
tree | 37e2c93bc6db1e27d3cbf58622862e152897d3af | |
parent | d79de93d888aa78e3caeab8d5288915cdb4c7f29 (diff) | |
download | chromium_src-a23ea81113ce25986e2ee2632a4ad4aebed7460f.zip chromium_src-a23ea81113ce25986e2ee2632a4ad4aebed7460f.tar.gz chromium_src-a23ea81113ce25986e2ee2632a4ad4aebed7460f.tar.bz2 |
Fixes a small memory leak in the Mac GPU info collector
This is a super easy mistake to make without the use of ScopedIOObject:
IOObjectRelease was never called on each registry entry after it was
done being used (see: https://goo.gl/LMDrqK).
Review URL: https://codereview.chromium.org/1380123002
Cr-Commit-Position: refs/heads/master@{#352029}
-rw-r--r-- | gpu/config/gpu_info_collector_mac.mm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gpu/config/gpu_info_collector_mac.mm b/gpu/config/gpu_info_collector_mac.mm index bbe3780..6105064 100644 --- a/gpu/config/gpu_info_collector_mac.mm +++ b/gpu/config/gpu_info_collector_mac.mm @@ -9,6 +9,7 @@ #include "base/logging.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" +#include "base/mac/scoped_ioobject.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" @@ -75,8 +76,9 @@ CollectInfoResult CollectPCIVideoCardInfo(GPUInfo* gpu_info) { if (IOServiceGetMatchingServices(kIOMasterPortDefault, match_dictionary, &entry_iterator) == kIOReturnSuccess) { - io_registry_entry_t entry; - while ((entry = IOIteratorNext(entry_iterator))) { + + base::mac::ScopedIOObject<io_registry_entry_t> entry; + while (entry.reset(IOIteratorNext(entry_iterator)), entry) { GPUInfo::GPUDevice gpu; if (GetEntryProperty(entry, CFSTR("class-code")) != 0x30000) { // 0x30000 : DISPLAY_VGA |