Initialize the states array with calloc in _macosx.m

To silence a warning about garbage data from the clang
static analyzer. Also check the calloc return value.
Release some unreleased objects in the macosx backend
Merge pull request #2994 from jkseppan/macosx-fixes

Minor fixes in _macosx.m