--- a/dix/events.c +++ b/dix/events.c @@ -1327,11 +1327,11 @@ RemoveTouchEventsFromQueue(DeviceIntPtr dev->deviceGrab.sync.event = malloc(sizeof(DeviceEvent)); memcpy(dev->deviceGrab.sync.event, first->event, sizeof(DeviceEvent)); + syncEvents.pending = first->next; + free(first); } else dev->deviceGrab.sync.event = NULL; - syncEvents.pending = first->next; - free(first); if (!syncEvents.pending) syncEvents.pendtail = NULL; }