Index: chrome/browser/extensions/api/identity/identity_api.cc |
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc |
index c513036534cf23165900eacc94798a45d6beac61..4b9562ba1cc37038b5596fb77e923c03b3ac1756 100644 |
--- a/chrome/browser/extensions/api/identity/identity_api.cc |
+++ b/chrome/browser/extensions/api/identity/identity_api.cc |
@@ -943,6 +943,8 @@ void IdentityLaunchWebAuthFlowFunction::OnAuthFlowFailure( |
break; |
} |
SendResponse(false); |
+ if (auth_flow_) |
+ auth_flow_.release()->DetachDelegateAndDelete(); |
Release(); // Balanced in RunAsync. |
} |
@@ -951,6 +953,8 @@ void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( |
if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { |
SetResult(new base::StringValue(redirect_url.spec())); |
SendResponse(true); |
+ if (auth_flow_) |
+ auth_flow_.release()->DetachDelegateAndDelete(); |
Release(); // Balanced in RunAsync. |
} |
} |