- Use MAP_FAILED error code for check whether mmap() was successful

- Replace various malloc() with Z_Malloc
- Fix several memory leaks when VM compilation failed and Com_Error is called
- Make failed mmap/VirtualAlloc/malloc calls fatal
This commit is contained in:
Thilo Schulz 2011-02-10 18:45:28 +00:00
parent 5e0d0efd2e
commit 544a1c0c1a
5 changed files with 50 additions and 27 deletions

View file

@ -1427,7 +1427,7 @@ static void sparc_compute_code(vm_t *vm, struct func_info * const fp)
data_and_code = mmap(NULL, code_length, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (!data_and_code)
if (data_and_code == MAP_FAILED)
DIE("Not enough memory");
code_now = code_begin = (unsigned int *)