diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/script_eob.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/script_eob.h | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/engines/kyra/script_eob.cpp b/engines/kyra/script_eob.cpp index e5f26be210..ffdb717484 100644 --- a/engines/kyra/script_eob.cpp +++ b/engines/kyra/script_eob.cpp @@ -157,10 +157,10 @@ EoBInfProcessor::~EoBInfProcessor() { delete[] _flagTable; delete[] _stack; delete[] _scriptData; - for (Common::Array<const InfOpcode *>::const_iterator a = _opcodes.begin(); a != _opcodes.end(); ++a) { - delete(*a)->proc; + + for (Common::Array<const InfOpcode *>::const_iterator a = _opcodes.begin(); a != _opcodes.end(); ++a) delete *a; - } + _opcodes.clear(); } diff --git a/engines/kyra/script_eob.h b/engines/kyra/script_eob.h index 3804db07c6..66323d6846 100644 --- a/engines/kyra/script_eob.h +++ b/engines/kyra/script_eob.h @@ -91,8 +91,10 @@ private: Screen_EoB *_screen; typedef Common::Functor1Mem<int8*, int, EoBInfProcessor> InfProc; - struct InfOpcode { + struct InfOpcode : private Common::NonCopyable { InfOpcode(InfProc *p, const char *d) : proc(p), desc(d) {} + ~InfOpcode() { delete proc; } + InfProc *proc; Common::String desc; }; |