Fix printf format warnings.
Move a buffer allocation.