section = mono_sgen_alloc_os_memory_aligned (LOS_SECTION_SIZE, LOS_SECTION_SIZE, TRUE);
+ if (!section)
+ return NULL;
+
free_chunks = (LOSFreeChunks*)((char*)section + LOS_CHUNK_SIZE);
free_chunks->size = LOS_SECTION_SIZE - LOS_CHUNK_SIZE;
free_chunks->next_size = los_fast_free_lists [0];
char *mem = VirtualAlloc (NULL, length + alignment, MEM_RESERVE, prot);
char *aligned;
- g_assert (mem);
+ if (!mem)
+ return NULL;
aligned = aligned_address (mem, length, alignment);
char *mem = mono_valloc (NULL, size + alignment, flags);
char *aligned;
- g_assert (mem);
+ if (!mem)
+ return NULL;
aligned = aligned_address (mem, size, alignment);