aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-06-17 17:31:32 +0200
committerUlrich Sibiller <uli42@gmx.de>2019-06-19 00:49:57 +0200
commit340de78e26e7837561909ae2a44c2ef85863d87b (patch)
treedfcb603e378766557e09ebeaa08d4e82835bb1d9
parent3b06ad51d91ff2b9442f159cddf34ed03bc2dd35 (diff)
downloadnx-libs-340de78e26e7837561909ae2a44c2ef85863d87b.tar.gz
nx-libs-340de78e26e7837561909ae2a44c2ef85863d87b.tar.bz2
nx-libs-340de78e26e7837561909ae2a44c2ef85863d87b.zip
Keyboard.c: nullify freed pointers
While trying to properly free memory allocated by XKB I accidently called nxagentFreeKeyboardDeviceData twice and noticed it would cause a segfault here. As the other pointers are also nullified after being freed let's just do it here, too.
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index 96b33ea7d..46686b754 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -1327,14 +1327,18 @@ static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev)
dev->focus = NULL;
}
- for (k = dev->kbdfeed; k; k = knext)
+ if (dev->kbdfeed)
{
- knext = k->next;
- #ifdef XKB
- if (k->xkb_sli)
- XkbFreeSrvLedInfo(k->xkb_sli);
- #endif
- free(k);
+ for (k = dev->kbdfeed; k; k = knext)
+ {
+ knext = k->next;
+ #ifdef XKB
+ if (k->xkb_sli)
+ XkbFreeSrvLedInfo(k->xkb_sli);
+ #endif
+ free(k);
+ }
+ dev->kbdfeed = NULL;
}
#ifdef DEBUG