From 69f87bebf125b1be5e6d6cfe3432b417d5ca505e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Jul 2019 21:07:25 -0700 Subject: GLK: ALAN3: Fix double-free of memory array --- engines/glk/alan3/exe.cpp | 2 +- engines/glk/alan3/utils.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'engines/glk/alan3') 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 -- cgit v1.2.3