Makefile tweaks
cstyle fixes
check return value after every malloc