Guard against allocs failing
In c++ 'new' will throw an bad_alloc if we can't allocate memory. This will effectively abort, but semi-gracefully. Where we use c style allocs, we should check even if we just exit. It's better than something unknown happening.