From eda36223e8062337cd40c97471749c519fcc7b9b Mon Sep 17 00:00:00 2001 From: Helmut Eller Date: Mon, 6 May 2024 10:07:14 +0200 Subject: [PATCH] Zero out terminal->keyboard_coding This avoids hard to reproduce crashes in fix_coding. * src/terminal.c (create_terminal): Use xzalloc instead of xmalloc. --- src/terminal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/terminal.c b/src/terminal.c index 23a5582d4d9..33f8623c214 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -24,6 +24,9 @@ #include "termchar.h" #include "termhooks.h" #include "keyboard.h" +#ifdef HAVE_MPS +#include "igc.h" +#endif #if HAVE_STRUCT_UNIPAIR_UNICODE # include @@ -281,8 +284,13 @@ create_terminal (enum output_method type, struct redisplay_interface *rif) terminal->rif = rif; terminal->id = next_terminal_id++; +#ifdef HAVE_MPS + terminal->keyboard_coding = xzalloc (sizeof (struct coding_system)); + terminal->terminal_coding = xzalloc (sizeof (struct coding_system)); +#else terminal->keyboard_coding = xmalloc (sizeof (struct coding_system)); terminal->terminal_coding = xmalloc (sizeof (struct coding_system)); +#endif /* If default coding systems for the terminal and the keyboard are already defined, use them in preference to the defaults. This is -- 2.39.2