MemArena: Fix a memory leak caused by pointer confusion

This code was ported from out_ptr, which was a double-pointer, and
wanted to double-check that the proper arena was actually allocated.

When I ported it to store the pointer directly in the view regardless
of whether out_ptr was non-NULL, I got confused here and instead
caused the code to only free the arena if the first byte was non-zero.
MemArena: Fix the calculation of position in SHM

The code to calculate the offsets into the SHM file wasn't properly
respecting the skip flags, causing it to calculate offsets beyond
the end of the SHM file.
MemArena: Merge the initialization code with the size calculation code

To make mistakes like in the previous commit less prevalent in the future.
Merge pull request #1478 from magcius/memmap-cleanup

MemArena: Fix a memory leak caused by pointer confusion