mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-25 06:31:32 +00:00
Fixed issue when there are no WebAssembly functions to allocate in memory
This commit is contained in:
@ -107,6 +107,10 @@ impl Instance {
|
|||||||
context_and_offsets.push((func_context, code_size_offset));
|
context_and_offsets.push((func_context, code_size_offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We only want to allocate in memory if there is more than
|
||||||
|
// 0 functions. Otherwise reserving a 0-sized memory
|
||||||
|
// cause a panic error
|
||||||
|
if total_size > 0 {
|
||||||
// Allocate the total memory for this functions
|
// Allocate the total memory for this functions
|
||||||
let map = MmapMut::map_anon(total_size).unwrap();
|
let map = MmapMut::map_anon(total_size).unwrap();
|
||||||
let region_start = map.as_ptr();
|
let region_start = map.as_ptr();
|
||||||
@ -132,6 +136,7 @@ impl Instance {
|
|||||||
.expect("unable to make memory readable+executable");
|
.expect("unable to make memory readable+executable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Instantiate tables
|
// Instantiate tables
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user