From 8a50d8744570e7a426c76cd0ed00c5db671fd366 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 16 Apr 2013 11:14:04 -0400 Subject: SCI: Fix potential memory leak with Mac cursor's hotspot --- engines/sci/engine/kgraphics.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'engines/sci/engine') diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index a65bcc215e..e4b3028bcd 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -185,10 +185,12 @@ static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) { hotspot = new Common::Point(argv[3].toSint16(), argv[4].toSint16()); // Fallthrough case 3: - if (g_sci->getPlatform() == Common::kPlatformMacintosh) - g_sci->_gfxCursor->kernelSetMacCursor(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot); - else + if (g_sci->getPlatform() == Common::kPlatformMacintosh) { + delete hotspot; // Mac cursors have their own hotspot, so ignore any we get here + g_sci->_gfxCursor->kernelSetMacCursor(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16()); + } else { g_sci->_gfxCursor->kernelSetView(argv[0].toUint16(), argv[1].toUint16(), argv[2].toUint16(), hotspot); + } break; case 10: // Freddy pharkas, when using the whiskey glass to read the prescription (bug #3034973) -- cgit v1.2.3