Use proper call for mmap
Cleanup memory even on failure
Initial mock tests