Commit 98fd60a6 authored by qinmin's avatar qinmin Committed by Commit bot

Fix a Use-after-free bug

CancelOnFailureAndDeleteSelf() should be the last call
DownloadTargetDeterminer can make.
After that, it is deleted.
Reporting the UMA first, then call CancelOnFailureAndDeleteSelf().

BUG=630370

Review-Url: https://codereview.chromium.org/2166163003
Cr-Commit-Position: refs/heads/master@{#407585}
parent 8aeb95ff
......@@ -324,9 +324,9 @@ void DownloadTargetDeterminer::ReserveVirtualPathDone(
#if BUILDFLAG(ANDROID_JAVA_UI)
if (!verified) {
if (path.empty()) {
CancelOnFailureAndDeleteSelf();
DownloadManagerService::OnDownloadCanceled(
download_, DownloadController::CANCEL_REASON_NO_EXTERNAL_STORAGE);
CancelOnFailureAndDeleteSelf();
return;
}
if (!download_->GetWebContents()) {
......@@ -334,10 +334,10 @@ void DownloadTargetDeterminer::ReserveVirtualPathDone(
// is no way to prompt user for an infobar. This could happen after chrome
// gets killed, and user tries to resume a download while another app has
// created the target file (not the temporary .crdownload file).
CancelOnFailureAndDeleteSelf();
DownloadManagerService::OnDownloadCanceled(
download_,
DownloadController::CANCEL_REASON_CANNOT_DETERMINE_DOWNLOAD_TARGET);
CancelOnFailureAndDeleteSelf();
return;
}
}
......
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