From fa6454ef4f10abb32f603a364f5e8f6fb224f92c Mon Sep 17 00:00:00 2001 From: sluicebox <22204938+sluicebox@users.noreply.github.com> Date: Thu, 2 Nov 2023 09:26:17 -0700 Subject: [PATCH] PRIVATE: Fix memory leaks in locations and inventory Coverity CID 1453259 Coverity CID 1453260 --- engines/private/private.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/private/private.cpp b/engines/private/private.cpp index 296832eb60b..71387f0d6ec 100644 --- a/engines/private/private.cpp +++ b/engines/private/private.cpp @@ -1488,7 +1488,8 @@ void PrivateEngine::loadLocations(const Common::Rect &rect) { Common::String s = Common::String::format("%sdryloc%d.bmp", _diaryLocPrefix.c_str(), i); - loadMask(s, rect.left + 120, rect.top + offset, true); + Graphics::Surface *surface = loadMask(s, rect.left + 120, rect.top + offset, true); + delete surface; } } } @@ -1497,7 +1498,8 @@ void PrivateEngine::loadInventory(uint32 x, const Common::Rect &r1, const Common int16 offset = 0; for (NameList::const_iterator it = inventory.begin(); it != inventory.end(); ++it) { offset = offset + 22; - loadMask(*it, r1.left, r1.top + offset, true); + Graphics::Surface *surface = loadMask(*it, r1.left, r1.top + offset, true); + delete surface; } }