Commit 50ad5cce authored by Min Qin's avatar Min Qin Committed by Commit Bot

Fix a use-after-free issue

ChromeDownloadManagerDelegate is owned by DownloadCoreServiceImpl.
So it may outlive DownloadManagerImpl. This CL fixes the use-after-free
issue by checking whether DownloadManagerImpl is still alive.

BUG=1142069

Change-Id: I6d7e39c3911ec6a27be3d8a99463929cc2a45527
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2504591Reviewed-by: default avatarXing Liu <xingliu@chromium.org>
Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Commit-Queue: Min Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821544}
parent 5588dd6c
......@@ -1241,6 +1241,8 @@ void ChromeDownloadManagerDelegate::GetFileMimeType(
void ChromeDownloadManagerDelegate::CheckClientDownloadDone(
uint32_t download_id,
safe_browsing::DownloadCheckResult result) {
if (!download_manager_)
return;
DownloadItem* item = download_manager_->GetDownload(download_id);
if (!item || (item->GetState() != DownloadItem::IN_PROGRESS &&
item->GetDangerType() !=
......
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