Skip to content

Commit 151e33c

Browse files
committed
[NFC][fuzzer] Cleanup SetThreadName after D156317
1 parent 45eb602 commit 151e33c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,10 @@ size_t PageSize() {
234234
}
235235

236236
void SetThreadName(std::thread &thread, const std::string &name) {
237-
std::wstring wname;
238237
auto sz = MultiByteToWideChar(CP_UTF8, 0, name.data(), name.size(), nullptr, 0);
239-
wname.resize(sz);
240-
if (sz == MultiByteToWideChar(CP_UTF8, 0, name.data(), name.size(), &wname[0],
241-
sz) > 0) {
238+
std::wstring wname(sz, L' ');
239+
if ((sz == MultiByteToWideChar(CP_UTF8, 0, name.data(), name.size(),
240+
&wname[0], sz)) > 0) {
242241
wname.resize(sz - 1);
243242
(void)SetThreadDescription(thread.native_handle(), wname.c_str());
244243
}

0 commit comments

Comments
 (0)