From a1001731fa50c730dcf834b724edfb89a8352298 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Mon, 2 Aug 2010 22:12:45 +0000 Subject: SCI: fixing leak kernel subfunctions svn-id: r51665 --- engines/sci/engine/kernel.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 73fb3de062..e702002199 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -43,8 +43,17 @@ Kernel::Kernel(ResourceManager *resMan, SegManager *segMan) } Kernel::~Kernel() { - for (KernelFunctionArray::iterator i = _kernelFuncs.begin(); i != _kernelFuncs.end(); ++i) - delete[] i->signature; + for (KernelFunctionArray::iterator it = _kernelFuncs.begin(); it != _kernelFuncs.end(); ++it) { + if (it->subFunctionCount) { + uint16 subFunctionNr = 0; + while (subFunctionNr < it->subFunctionCount) { + delete[] it->subFunctions[subFunctionNr].signature; + subFunctionNr++; + } + delete[] it->subFunctions; + } + delete[] it->signature; + } } uint Kernel::getSelectorNamesSize() const { -- cgit v1.2.3