aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/vm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine/vm.cpp')
-rw-r--r--engines/sci/engine/vm.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 92da5c297b..af40f7a522 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1702,7 +1702,8 @@ int script_instantiate_common(EngineState *s, int script_nr, Resource **script,
} else {
seg_id = seg;
mem = s->seg_manager->heap[seg];
- s->seg_manager->freeScript(mem);
+ assert(mem);
+ s->seg_manager->freeScript(mem->data.script);
}
} else if (!(mem = s->seg_manager->allocateScript(s, script_nr, &seg_id))) { // ALL YOUR SCRIPT BASE ARE BELONG TO US
sciprintf("Not enough heap space for script size 0x%x of script 0x%x, should this happen?`\n", (*script)->size, script_nr);
@@ -1710,7 +1711,7 @@ int script_instantiate_common(EngineState *s, int script_nr, Resource **script,
return 0;
}
- s->seg_manager->initialiseScript(mem, s, script_nr);
+ s->seg_manager->initialiseScript(mem->data.script, s, script_nr);
reg.segment = seg_id;
reg.offset = 0;