diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2021-01-04 17:18:43 +0100 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2021-01-15 19:50:36 +0100 |
commit | 7443fea69f89fda3c36e99dc5ff07731020e8891 (patch) | |
tree | 347178a00db63547abc0283e9c848c6d19d19a95 | |
parent | e664d82019ef2a876cc325c746b4e7521b9c1910 (diff) | |
download | nx-libs-7443fea69f89fda3c36e99dc5ff07731020e8891.tar.gz nx-libs-7443fea69f89fda3c36e99dc5ff07731020e8891.tar.bz2 nx-libs-7443fea69f89fda3c36e99dc5ff07731020e8891.zip |
Keyboard.c: fix possible NULL pointer dereference
found by PVS Studio: "V522 There might be dereferencing of a potential
null pointer 'keymap'."
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 8f29d66b8..731844874 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -435,6 +435,11 @@ N/A int len = (max_keycode - min_keycode + 1) * mapWidth; keymap = (KeySym *)malloc(len * sizeof(KeySym)); + if (keymap == NULL) + { + XFreeModifiermap(modifier_keymap); + return -1; + } for(int i = 0; i < len; ++i) { keymap[i] = keymap64[i]; |