1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-10 06:01:52 +00:00

mem: fix rare crash/logic error in heap allocation code

This commit is contained in:
Michael Scire 2021-05-26 20:43:03 -07:00
parent c790d03693
commit 0f2855ada8

View file

@ -976,13 +976,14 @@ namespace ams::mem::impl::heap {
return span;
}
} else {
const size_t prev_pages = span->num_pages;
Span *new_span = this->AllocateSpanStruct();
if (new_span == nullptr) {
return nullptr;
}
auto new_span_guard = SCOPE_GUARD { this->FreeSpanToSpanPage(new_span); };
const size_t prev_pages = span->num_pages;
span = GetSpanFromPointer(std::addressof(this->span_table), span->start.p);
const size_t found_pages = span->num_pages;