mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
fixed a potential memory leak. oopsie!
This commit is contained in:
parent
d42da07721
commit
e8ec7382af
|
|
@ -28,8 +28,10 @@ void AuthProfileManager::load()
|
||||||
auto readWstr = [&file]() -> wstring {
|
auto readWstr = [&file]() -> wstring {
|
||||||
uint16_t len = 0;
|
uint16_t len = 0;
|
||||||
file.read(reinterpret_cast<char *>(&len), sizeof(len));
|
file.read(reinterpret_cast<char *>(&len), sizeof(len));
|
||||||
|
if (!file || len > 4096) return {};
|
||||||
wstring s(len, L'\0');
|
wstring s(len, L'\0');
|
||||||
file.read(reinterpret_cast<char *>(s.data()), len * sizeof(wchar_t));
|
file.read(reinterpret_cast<char *>(s.data()), len * sizeof(wchar_t));
|
||||||
|
if (!file) return {};
|
||||||
return s;
|
return s;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue