check whether (re-)allocation succeeded

fixes mthom/scryer-prolog#2449
This commit is contained in:
Bennet Bleßmann
2024-08-11 19:19:00 +02:00
committed by Bennet Bleßmann
parent 775b14c537
commit cc51b8150d
3 changed files with 70 additions and 48 deletions

View File

@@ -174,7 +174,9 @@ impl Stack {
let ptr = self.buf.alloc(frame_size);
if ptr.is_null() {
self.buf.grow();
if !self.buf.grow() {
panic!("growing the stack failed")
}
} else {
return ptr;
}