SystemTools: Replace malloc() with std::string
Refactor to avoid use of malloc in C++. To get a char*,
use C++11 style &buf[0] rather than C++17 buf.data().
This is the only place in KWSys where malloc was used for string data in C++.
Edited by Brad King