Is adding a char from a char* to a std::string and then delete[] the char array can cause UB?
or is it safe to process the string after the delete[] ?
int buffer_size = 4096;
char* buffer = new char[buffer_size];
//here there was removed code that assign values to the buffer[i]
std::string data;
for (int i = 0; i < buffer_size ; i++)
{
data.push_back(buffer[i]);
}
delete[] buffer;
//is the data string content secured at this point?