aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2019-07-05 21:07:25 -0700
committerPaul Gilbert2019-07-06 15:27:09 -0700
commit69f87bebf125b1be5e6d6cfe3432b417d5ca505e (patch)
tree5690b41cb155d9656896b3cd54febd6421e243eb
parent17d0459566bf570c34ba6873370aff71fd016d1b (diff)
downloadscummvm-rg350-69f87bebf125b1be5e6d6cfe3432b417d5ca505e.tar.gz
scummvm-rg350-69f87bebf125b1be5e6d6cfe3432b417d5ca505e.tar.bz2
scummvm-rg350-69f87bebf125b1be5e6d6cfe3432b417d5ca505e.zip
GLK: ALAN3: Fix double-free of memory array
-rw-r--r--engines/glk/alan3/exe.cpp2
-rw-r--r--engines/glk/alan3/utils.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/engines/glk/alan3/exe.cpp b/engines/glk/alan3/exe.cpp
index 8c22742347..fbb0db53f4 100644
--- a/engines/glk/alan3/exe.cpp
+++ b/engines/glk/alan3/exe.cpp
@@ -205,7 +205,7 @@ void quitGame(CONTEXT) {
current.location = where(HERO, DIRECT);
para();
- while (TRUE) {
+ while (!g_vm->shouldQuit()) {
col = 1;
CALL0(g_io->statusLine)
printMessage(M_QUITACTION);
diff --git a/engines/glk/alan3/utils.cpp b/engines/glk/alan3/utils.cpp
index acbf8e490a..06ce3af7ae 100644
--- a/engines/glk/alan3/utils.cpp
+++ b/engines/glk/alan3/utils.cpp
@@ -49,8 +49,10 @@ void terminate(CONTEXT, int code) {
stopTranscript();
- if (memory)
+ if (memory) {
deallocate(memory);
+ memory = nullptr;
+ }
g_io->glk_exit();
LONG_JUMP