Index: chrome/browser/profiles/profile_manager.cc |
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc |
index 46f22de0686b9eddf7160ae86045d8e8482b3902..6380cea9e3587e3e6db5310ea7a584bd0cae9373 100644 |
--- a/chrome/browser/profiles/profile_manager.cc |
+++ b/chrome/browser/profiles/profile_manager.cc |
@@ -1103,7 +1103,8 @@ void ProfileManager::OnProfileCreated(Profile* profile, |
profile = profile->GetOffTheRecordProfile(); |
info->created = true; |
} else { |
- profile = NULL; |
+ profile = nullptr; |
+ failed_profiles_.push_back(std::move(iter->second->profile)); |
profiles_info_.erase(iter); |
// TODO(yiyaoliu): This is temporary, remove it after it's not used. |
UMA_HISTOGRAM_COUNTS_100("UMA.ProfilesCount.AfterErase", |
@@ -1516,7 +1517,8 @@ ProfileManager::ProfileInfo::ProfileInfo( |
} |
ProfileManager::ProfileInfo::~ProfileInfo() { |
- ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
+ if (profile) |
+ ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
} |
#if !defined(OS_ANDROID) |