From ae7da3e83027b185c2a16cbfde94fafae8ec8531 Mon Sep 17 00:00:00 2001 From: Ian Spence Date: Wed, 30 Dec 2015 08:57:43 -0800 Subject: [PATCH] Fix #2550 Program crashes when executing "exit" command from the console - exit and quit commands are aliased to "hide" - value of the command was being set to a constant value and could not be freed - updated command value to use a freeable value --- src/interface/console.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/interface/console.c b/src/interface/console.c index c32f79dc82..6ca8916546 100644 --- a/src/interface/console.c +++ b/src/interface/console.c @@ -1045,8 +1045,10 @@ void console_execute_silent(const utf8 *src) return; // Aliases for hiding the console - if(strcmp(argv[0],"quit") == 0 || strcmp(argv[0],"exit") == 0) - argv[0]="hide"; + if(strcmp(argv[0],"quit") == 0 || strcmp(argv[0],"exit") == 0) { + free(argv[0]); + argv[0] = _strdup("hide"); + } bool validCommand = false; for (int i = 0; i < countof(console_command_table); i++) {