Replace some raw arrays with std::vectors.
[dcpomatic.git] / src / lib / cross_windows.cc
index a7e7bdd555255830550915a00c4524048e03cc94..f7638083656c2731411075144fbd10f8b72f9a2b 100644 (file)
@@ -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;
 }