core/shared/platform: Zero memory returned by os_mmap in some platforms (#3551)
The os_mmap should zero the mapped memory like what posix mmap does.
This commit is contained in:
@ -52,9 +52,15 @@ os_dumps_proc_mem_info(char *out, unsigned int size)
|
||||
void *
|
||||
os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
|
||||
{
|
||||
if (size > ((unsigned)~0))
|
||||
void *addr;
|
||||
|
||||
if (size >= UINT32_MAX)
|
||||
return NULL;
|
||||
return BH_MALLOC((unsigned)size);
|
||||
|
||||
if ((addr = BH_MALLOC((uint32)size)))
|
||||
memset(addr, 0, (uint32)size);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
void *
|
||||
@ -88,4 +94,4 @@ os_dcache_flush(void)
|
||||
|
||||
void
|
||||
os_icache_flush(void *start, size_t len)
|
||||
{}
|
||||
{}
|
||||
|
||||
Reference in New Issue
Block a user