aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2019-07-04 20:54:59 -0700
committerPaul Gilbert2019-07-06 15:27:09 -0700
commit4de30c9e2f02d028660bbfa1011047747abba548 (patch)
tree07b257220ac736e19d82dbf2b37aa701e0b32255
parent87a86c0fb61add346a368c27407be990c2827c4c (diff)
downloadscummvm-rg350-4de30c9e2f02d028660bbfa1011047747abba548.tar.gz
scummvm-rg350-4de30c9e2f02d028660bbfa1011047747abba548.tar.bz2
scummvm-rg350-4de30c9e2f02d028660bbfa1011047747abba548.zip
GLK: ALAN3: Fix Valgrind identified memory issues
-rw-r--r--engines/glk/alan3/output.cpp4
-rw-r--r--engines/glk/alan3/save.cpp2
2 files changed, 4 insertions, 2 deletions
diff --git a/engines/glk/alan3/output.cpp b/engines/glk/alan3/output.cpp
index 0d946114dc..1ac2cd69a7 100644
--- a/engines/glk/alan3/output.cpp
+++ b/engines/glk/alan3/output.cpp
@@ -424,10 +424,12 @@ void output(const char *original) {
if (lastCharOf(str) != ' ')
needSpace = TRUE;
}
+
if (needSpace)
capitalize = strchr("!?.", str[strlen(str) - 1]) != 0;
+
anyOutput = TRUE;
- free(copy);
+ delete[] copy;
}
diff --git a/engines/glk/alan3/save.cpp b/engines/glk/alan3/save.cpp
index da1d5b6ba4..839ce2bdee 100644
--- a/engines/glk/alan3/save.cpp
+++ b/engines/glk/alan3/save.cpp
@@ -66,7 +66,7 @@ void syncGame(Common::Serializer &s) {
current.synchronize(s);
// Attributes area
- for (Aint i = 0; i < header->attributesAreaSize; ++i)
+ for (Aint i = 0; i < header->attributesAreaSize / 3; ++i)
attributes[i].synchronize(s);
// Admin data