Any reason why you use a pointer instead of having this function return an std::string object? The latter would be a lot cleaner to use.