Commit 899f175b authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[base][win] Better check in SetSystemPagesAccessInternal

I made improvements to https://crrev.com/c/1336130 but I forgot
to save them. With this CL we should get more information about
crashes on Windows.

R=haraken@chromium.org

Change-Id: Ie1cea16e9e6574cb9028a165d8bf5a68465bd965
Reviewed-on: https://chromium-review.googlesource.com/c/1338099Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609240}
parent 80fd0f07
......@@ -80,10 +80,18 @@ void SetSystemPagesAccessInternal(
size_t length,
PageAccessibilityConfiguration accessibility) {
if (accessibility == PageInaccessible) {
CHECK_NE(0, VirtualFree(address, length, MEM_DECOMMIT));
if (!VirtualFree(address, length, MEM_DECOMMIT)) {
// We check `GetLastError` for `ERROR_SUCCESS` here so that in a crash
// report we get the error number.
CHECK_EQ(static_cast<uint32_t>(ERROR_SUCCESS), GetLastError());
}
} else {
CHECK_NE(nullptr, VirtualAlloc(address, length, MEM_COMMIT,
GetAccessFlags(accessibility)));
if (!VirtualAlloc(address, length, MEM_COMMIT,
GetAccessFlags(accessibility))) {
// We check `GetLastError` for `ERROR_SUCCESS` here so that in a crash
// report we get the error number.
CHECK_EQ(static_cast<uint32_t>(ERROR_SUCCESS), GetLastError());
}
}
}
......
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