diff options
Diffstat (limited to 'src/lib/cross_windows.cc')
| -rw-r--r-- | src/lib/cross_windows.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/cross_windows.cc b/src/lib/cross_windows.cc index a7e7bdd55..f76380836 100644 --- a/src/lib/cross_windows.cc +++ b/src/lib/cross_windows.cc @@ -353,10 +353,9 @@ static string wchar_to_utf8 (wchar_t const * s) { int const length = (wcslen(s) + 1) * 2; - char* utf8 = new char[length]; - WideCharToMultiByte (CP_UTF8, 0, s, -1, utf8, length, 0, 0); - string u (utf8); - delete[] utf8; + std::vector<char> utf8(length); + WideCharToMultiByte (CP_UTF8, 0, s, -1, utf8.data(), length, 0, 0); + string u (utf8.data()); return u; } |
