From bbe2c2ab97b9882738b9ea985b5e1a3f86006999 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 2 Jan 2020 21:10:40 +0100 Subject: Keyboard.c: fix: handle empty string --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 0ebaf677b..756613ab1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -549,6 +549,12 @@ XkbError: XkbComponentNamesRec names = {0}; char *rules = NULL, *variant = NULL, *options = NULL; /* use xkb default */ + /* handle empty string like the NULL pointer */ + if (nxagentKeyboard && nxagentKeyboard[0] == '\0') + { + SAFE_free(nxagentKeyboard); + } + #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Using XKB extension.\n"); fprintf(stderr, "nxagentKeyboardProc: nxagentKeyboard is [%s].\n", nxagentKeyboard ? nxagentKeyboard : "NULL"); -- cgit v1.2.3