We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
OutOfMemory
alloc_dynamic_table_elements
1 parent 4bb429a commit d92b523Copy full SHA for d92b523
crates/wasmtime/src/runtime/vm/table.rs
@@ -314,7 +314,9 @@ unsafe fn alloc_dynamic_table_elements<T>(len: usize) -> Result<Vec<Option<T>>>
314
let layout = Layout::from_size_align(size, align)?;
315
316
let ptr = unsafe { alloc::alloc::alloc_zeroed(layout) };
317
- ensure!(!ptr.is_null(), "failed to allocate memory for table");
+ if ptr.is_null() {
318
+ return Err(OutOfMemory::new(size).into());
319
+ }
320
321
let elems = unsafe { Vec::<Option<T>>::from_raw_parts(ptr.cast(), len, len) };
322
debug_assert!(elems.iter().all(|e| e.is_none()));
0 commit comments