[C API] Fix str copy to char* issue in debug & release mode, issue number 18019 (#18097)

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>
This commit is contained in:
Xuejun Zhai authored and GitHub committed 2023-06-16 12:31:31 +04:00
1 parent f5dc8e7796
commit e56405ef3b
1 file changed
+1 -1
+1 -1
View File
@@ -13,7 +13,7 @@
char* str_to_char_array(const std::string& str) {
std::unique_ptr<char> _char_array(new char[str.length() + 1]);
char* char_array = _char_array.release();
std::copy_n(str.begin(), str.length() + 1, char_array);
std::copy_n(str.c_str(), str.length() + 1, char_array);
return char_array;
}