mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2025-01-03 11:11:14 +00:00
mem: fix rare crash/logic error in heap allocation code
This commit is contained in:
parent
c790d03693
commit
0f2855ada8
1 changed files with 2 additions and 1 deletions
|
@ -976,13 +976,14 @@ namespace ams::mem::impl::heap {
|
||||||
return span;
|
return span;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const size_t prev_pages = span->num_pages;
|
||||||
|
|
||||||
Span *new_span = this->AllocateSpanStruct();
|
Span *new_span = this->AllocateSpanStruct();
|
||||||
if (new_span == nullptr) {
|
if (new_span == nullptr) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto new_span_guard = SCOPE_GUARD { this->FreeSpanToSpanPage(new_span); };
|
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);
|
span = GetSpanFromPointer(std::addressof(this->span_table), span->start.p);
|
||||||
const size_t found_pages = span->num_pages;
|
const size_t found_pages = span->num_pages;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue