Fixes for OSX

Fix some compilation problems on OSX:
- "malloc.h" is not available
- "memalign" is not available (but "posix_memalign")