Commit 340de78e authored by Ulrich Sibiller's avatar Ulrich Sibiller

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.
parent 3b06ad51
...@@ -1327,6 +1327,8 @@ static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev) ...@@ -1327,6 +1327,8 @@ static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev)
dev->focus = NULL; dev->focus = NULL;
} }
if (dev->kbdfeed)
{
for (k = dev->kbdfeed; k; k = knext) for (k = dev->kbdfeed; k; k = knext)
{ {
knext = k->next; knext = k->next;
...@@ -1336,6 +1338,8 @@ static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev) ...@@ -1336,6 +1338,8 @@ static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev)
#endif #endif
free(k); free(k);
} }
dev->kbdfeed = NULL;
}
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentFreeKeyboardDeviceData: Freed device data.\n"); fprintf(stderr, "nxagentFreeKeyboardDeviceData: Freed device data.\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment