Commit ef37ad03 authored by jiayl@chromium.org's avatar jiayl@chromium.org

Fixes a leak of WebRTCIdentityRequestHandle when...

Fixes a leak of WebRTCIdentityRequestHandle when WebRTCIdentityStoreBackend::FindIdentity returns false.

BUG=

Review URL: https://chromiumcodereview.appspot.com/22888002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217108 0039d316-1c4b-4281-b951-d872f2087c98
parent 4f517124
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment