aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2010-06-28 14:46:28 +0000
committerMartin Kiewitz2010-06-28 14:46:28 +0000
commit66fb9e7a90874e27486db98f0eb8d6f0512a00c5 (patch)
treeb9a6bca1e53d97b1c14df7cb050aa83fdccddf34 /engines/sci
parent6402d644199e17cbf7770c98ebf8c1edca7c4cca (diff)
downloadscummvm-rg350-66fb9e7a90874e27486db98f0eb8d6f0512a00c5.tar.gz
scummvm-rg350-66fb9e7a90874e27486db98f0eb8d6f0512a00c5.tar.bz2
scummvm-rg350-66fb9e7a90874e27486db98f0eb8d6f0512a00c5.zip
SCI: fixing valgrind issue in Script::initialiseClasses thx to wjp for valgrind testing
svn-id: r50446
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/script.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/engines/sci/engine/script.cpp b/engines/sci/engine/script.cpp
index bc63afece5..4100ca6448 100644
--- a/engines/sci/engine/script.cpp
+++ b/engines/sci/engine/script.cpp
@@ -410,12 +410,14 @@ void Script::initialiseClasses(SegManager *segMan) {
if (!seeker)
return;
+ uint16 marker;
+ bool isClass;
+ uint16 classpos = seeker - _buf;
+ int16 species = 0;
+
while (true) {
// In SCI0-SCI1, this is the segment type. In SCI11, it's a marker (0x1234)
- uint16 marker = READ_SCI11ENDIAN_UINT16(seeker);
- bool isClass;
- uint16 classpos = seeker - _buf;
- int16 species;
+ marker = READ_SCI11ENDIAN_UINT16(seeker);
if (!marker)
break;
@@ -425,7 +427,8 @@ void Script::initialiseClasses(SegManager *segMan) {
species = READ_SCI11ENDIAN_UINT16(seeker + 10);
} else {
isClass = (marker == SCI_OBJ_CLASS);
- species = READ_SCI11ENDIAN_UINT16(seeker + 12);
+ if (isClass)
+ species = READ_SCI11ENDIAN_UINT16(seeker + 12);
classpos += 12;
}