add CHECK_malloc macro, change to single "happy path"