Use a std::string rather than a dynamically allocated char* buffer.