From d933ba88b7abaf02a25527ade4960a514832f70a Mon Sep 17 00:00:00 2001 From: Matt Heffron Date: Sat, 16 Dec 2023 15:14:02 -0800 Subject: [PATCH] XFree(mapping) was called *before* mapping was referenced in DEBUG conditional code. (#486) This is only a potential issue in DEBUG build. A problem hasn't occurred, that I know of, but it seemed best just to be safe. Moved the DEBUG code to precede the XFree(mapping) call. (Equivalent to moving the XFree down.) --- src/initkbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/initkbd.c b/src/initkbd.c index 39612f3..8a45528 100644 --- a/src/initkbd.c +++ b/src/initkbd.c @@ -375,8 +375,6 @@ static u_char *make_X_keymap(void) { table[xcode - 7] = code; } - XFree(mapping); /* No locking required? */ - #ifdef DEBUG printf("\n\n\tXGetKeyboardMapping table\n\n"); for (i = 0; i < codecount * symspercode; i += symspercode) { @@ -394,6 +392,8 @@ static u_char *make_X_keymap(void) { } #endif /* DEBUG */ + XFree(mapping); /* No locking required? */ + return (table); }