summaryrefslogtreecommitdiff
blob: 6b16b65d18f6dd131e071103b7679a9a6cee2c05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
--- 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;
     }