1. strdup(const char*) will copy a temporary char array. 2. std::string's copy construct will copy the temporary char array to std::string buffer. 3. finally the temporary char array will leak.
1. strdup(const char*) will copy a temporary char array. 2. std::string's copy construct will copy the temporary char array to std::string buffer. 3. finally the temporary char array will leak.