Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: chrome/browser/system_monitor/portable_device_watcher_win.cc

Issue 11743008: Clean up: Use scoped_ptr<Foo[]> instead of scoped_array<Foo> in PortableDeviceWatcherWin::Enumerate… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/system_monitor/portable_device_watcher_win.cc
diff --git a/chrome/browser/system_monitor/portable_device_watcher_win.cc b/chrome/browser/system_monitor/portable_device_watcher_win.cc
index 70a9f7f229b2a6ec24e2718c6f3bf46c33d2a06d..de24792c5e69757793fc5af935255a23c111faa7 100644
--- a/chrome/browser/system_monitor/portable_device_watcher_win.cc
+++ b/chrome/browser/system_monitor/portable_device_watcher_win.cc
@@ -408,8 +408,7 @@ bool EnumerateAttachedDevicesOnBlockingThread(
if (FAILED(hr))
return false;
- scoped_array<char16*> pnp_device_ids(new char16*[pnp_device_count]);
- ZeroMemory(pnp_device_ids.get(), pnp_device_count);
+ scoped_ptr<char16*[]> pnp_device_ids(new char16*[pnp_device_count]);
hr = portable_device_mgr->GetDevices(pnp_device_ids.get(), &pnp_device_count);
if (FAILED(hr))
return false;
@@ -420,6 +419,8 @@ bool EnumerateAttachedDevicesOnBlockingThread(
portable_device_mgr, pnp_device_ids[index], &device_details))
devices->push_back(device_details);
}
+ for (DWORD index = 0; index < pnp_device_count; ++index)
+ CoTaskMemFree(pnp_device_ids[index]);
kmadhusu 2013/01/03 00:25:52 As per http://msdn.microsoft.com/en-us/library/win
Lei Zhang 2013/01/03 21:15:26 Why not just do this at the end of the loop right
kmadhusu 2013/01/03 21:36:21 Done.
return !devices->empty();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698