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

Unified Diff: chrome/browser/profiles/profile_downloader.cc

Issue 1341113002: Fix a use-after-free in ProfileDownloader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments Created 5 years, 3 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/profiles/profile_downloader.cc
diff --git a/chrome/browser/profiles/profile_downloader.cc b/chrome/browser/profiles/profile_downloader.cc
index 04f052c2177cc557cc165533fce0b7e24cf5056c..4eb0c33e2cf203c7fcdf2754335f4c162cfe6f5a 100644
--- a/chrome/browser/profiles/profile_downloader.cc
+++ b/chrome/browser/profiles/profile_downloader.cc
@@ -229,10 +229,14 @@ void ProfileDownloader::StartFetchingImage() {
->FetchUserInfoBeforeSignin(account_id_);
}
- if (account_info_.IsValid())
+ if (account_info_.IsValid()) {
+ // FetchImageData might call the delegate's OnProfileDownloadSuccess
+ // synchronously, causing |this| to be deleted so there should not be more
+ // code after it.
FetchImageData();
- else
+ } else {
waiting_for_account_info_ = true;
+ }
}
void ProfileDownloader::StartFetchingOAuth2AccessToken() {
@@ -385,8 +389,11 @@ void ProfileDownloader::OnAccountUpdated(const AccountInfo& info) {
// If the StartFetchingImage was called before we had valid info, the
// downloader has been waiting so we need to fetch the image data now.
if (waiting_for_account_info_) {
- FetchImageData();
waiting_for_account_info_ = false;
+ // FetchImageData might call the delegate's OnProfileDownloadSuccess
+ // synchronously, causing |this| to be deleted so there should not be more
+ // code after it.
+ FetchImageData();
}
}
}
« 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