Use the exact type in malloc(N * sizeof(TYPE*)) etc

This is clearer and silences warnings from clang's static analyzer.
Fix pointer arithmetic [minor]

Pointer arithmetic on void pointers is a GCC extension.
Add HTS_NORETURN and annotate fail() as such

This suppresses false positives from clang's static analyzer.  Eventually
HTS_NORETURN might migrate to the public API, if the API were to acquire
such things.

(The noreturn attribute has been supported since GCC 2.5 and clang 1.4,
but this approximation is close enough.)