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

Unified Diff: content/browser/media/webrtc_identity_store.cc

Issue 22888002: Fixes a leak of WebRTCIdentityRequestHandle when WebRTCIdentityStoreBackend::FindIdentity returns f… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/webrtc_identity_store.cc
diff --git a/content/browser/media/webrtc_identity_store.cc b/content/browser/media/webrtc_identity_store.cc
index 1c778624ccf2732ce039f33889ecacc905f590a2..67a25851fdeaf01de9c0611b6e892804e76ee771 100644
--- a/content/browser/media/webrtc_identity_store.cc
+++ b/content/browser/media/webrtc_identity_store.cc
@@ -187,30 +187,29 @@ base::Closure WebRTCIdentityStore::RequestIdentity(
const std::string& common_name,
const CompletionCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
- WebRTCIdentityRequestHandle* handle =
- new WebRTCIdentityRequestHandle(this, callback);
-
WebRTCIdentityRequest* request =
FindRequest(origin, identity_name, common_name);
-
// If there is no identical request in flight, create a new one, queue it,
// and make the backend request.
if (!request) {
request = new WebRTCIdentityRequest(origin, identity_name, common_name);
-
+ // |request| will delete itself after the result is posted.
if (!backend_->FindIdentity(
origin,
identity_name,
common_name,
base::Bind(
&WebRTCIdentityStore::BackendFindCallback, this, request))) {
+ // Bail out if the backend failed to start the task.
delete request;
return base::Closure();
}
in_flight_requests_.push_back(request);
}
+ WebRTCIdentityRequestHandle* handle =
+ new WebRTCIdentityRequestHandle(this, callback);
+
request->AddCallback(
handle,
base::Bind(&WebRTCIdentityRequestHandle::OnRequestComplete,
« 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