malloc: check for nil