Mac: Codify SDK and OS requirements, and clean up.

This #errors if you're using an SDK or deployment target that is less
than 10.6 and 10.5, respectively, and cleans up uses of
MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED according
to those requirements.
Fix some clang analyzer warnings.

This fixes some analyzer warnings and a couple of minor memory leaks.
Fix build errors from last change.
= {{0}} generates a memset() in MSVC, which isn't linked. Whoops!