TWP: Fix memory leak in capture

Coverity CID 1540483
This commit is contained in:
scemino 2024-03-19 21:31:57 +01:00
parent cdc8d16fd5
commit 0b574ab76b

View File

@ -1763,10 +1763,12 @@ void TwpEngine::capture(Common::WriteStream &stream, Math::Vector2d size) {
Graphics::Surface s;
s.init(SCREEN_WIDTH, SCREEN_HEIGHT, 4 * SCREEN_WIDTH, data.data(), fmt);
s.flipVertical(Common::Rect(s.w, s.h));
s.scale(size.getX(), size.getY());
Graphics::Surface *scaledSurface = s.scale(size.getX(), size.getY());
// and save to stream
Image::writePNG(stream, s);
delete scaledSurface;
}
HSQUIRRELVM TwpEngine::getVm() { return _vm->get(); }