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

Unified Diff: chrome/browser/extensions/api/usb/usb_api.cc

Issue 22492003: Fixes leaking transfer objects due to improper USB handle closure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor fix Created 7 years, 4 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 | chrome/browser/usb/usb_device.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/usb/usb_api.cc
diff --git a/chrome/browser/extensions/api/usb/usb_api.cc b/chrome/browser/extensions/api/usb/usb_api.cc
index f21e1b8a58a6dd0030a1dfa518882b3f1c25717c..878e3625dd45655fd6e019ddaa846e11110f5c23 100644
--- a/chrome/browser/extensions/api/usb/usb_api.cc
+++ b/chrome/browser/extensions/api/usb/usb_api.cc
@@ -474,8 +474,12 @@ void UsbFindDevicesFunction::EnumerateDevices(
void UsbFindDevicesFunction::OnEnumerationCompleted(
ScopedDeviceVector devices) {
- for (size_t i = 0; i < devices->size(); ++i)
- device_handles_.push_back(devices->at(i)->Open());
+ for (size_t i = 0; i < devices->size(); ++i) {
+ scoped_refptr<UsbDeviceHandle> device_handle =
+ devices->at(i)->Open();
+ if (device_handle)
+ device_handles_.push_back(device_handle);
+ }
BrowserThread::PostTask(
BrowserThread::IO,
« no previous file with comments | « no previous file | chrome/browser/usb/usb_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698