Code:
std::string new_str = data;
free(data);
If data is a string with a null terminate character, will std::string copy all the characters from data?
So am i safe to free the data pointer?

Thank you.