Fix memory leak in protocol 38 set_sky

This commit is contained in:
sfan5 2020-03-05 22:36:21 +01:00 committed by GitHub
parent db95ff2286
commit 9ca0b3739c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1244,12 +1244,11 @@ void Client::handleCommand_HudSetSky(NetworkPacket* pkt)
skybox.bgcolor = video::SColor(readARGB8(is)); skybox.bgcolor = video::SColor(readARGB8(is));
skybox.type = std::string(deSerializeString(is)); skybox.type = std::string(deSerializeString(is));
u16 count = readU16(is); u16 count = readU16(is);
std::vector<std::string>* params = new std::vector<std::string>;
for (size_t i = 0; i < count; i++) for (size_t i = 0; i < count; i++)
skybox.textures.emplace_back(deSerializeString(is)); skybox.textures.emplace_back(deSerializeString(is));
bool clouds = true; skybox.clouds = true;
try { try {
skybox.clouds = readU8(is); skybox.clouds = readU8(is);
} catch (...) {} } catch (...) {}