This commit is contained in:
Edo 2024-01-31 01:14:17 +01:00 committed by GitHub
parent 1f6716eb56
commit 5bab1ba0cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,9 +131,10 @@ namespace Utils
return; return;
} }
const auto _0 = gsl::finally([&] { std::free(buffer); });
SetCurrentDirectoryA(buffer); SetCurrentDirectoryA(buffer);
SetDllDirectoryA(buffer); SetDllDirectoryA(buffer);
std::free(buffer);
} }
/** /**
@ -148,16 +149,16 @@ namespace Utils
return {}; return {};
} }
const auto _0 = gsl::finally([&] { std::free(buffer); });
try try
{ {
std::filesystem::path result = buffer; std::filesystem::path result = buffer;
std::free(buffer);
return result; return result;
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
printf("Failed to convert '%s' to native file system path. Got error '%s'\n", buffer, ex.what()); printf("Failed to convert '%s' to native file system path. Got error '%s'\n", buffer, ex.what());
std::free(buffer);
return {}; return {};
} }
} }