Check malloc calls for null results