From 0887199400cccc7d666ed22a9864665b43376c72 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 7 Jun 2016 22:20:18 +0200 Subject: SCUMM HE: Fix crashes in Moonbase replay --- engines/scumm/he/moonbase/moonbase_fow.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'engines/scumm/he') diff --git a/engines/scumm/he/moonbase/moonbase_fow.cpp b/engines/scumm/he/moonbase/moonbase_fow.cpp index b68d6051ff..77f40a7d97 100644 --- a/engines/scumm/he/moonbase/moonbase_fow.cpp +++ b/engines/scumm/he/moonbase/moonbase_fow.cpp @@ -114,8 +114,14 @@ bool Moonbase::setFOWImage(int image) { delete stream; } - if (!_fowImage && image > 0) - _fowImage = _vm->getResourceAddress(rtImage, image); + if (!_fowImage && image > 0) { + int sz = _vm->getResourceSize(rtImage, image); + _fowImage = (uint8 *)malloc(sz); + + // We have to copy it, otherwise the resource manager + // will kill it earlier or later. Matches original. + memcpy(_fowImage, _vm->getResourceAddress(rtImage, image), sz); + } if (!_fowImage) return false; -- cgit v1.2.3