correct type error in buffer malloc