mi: Fix undefined memcpy in mieqGrowQueue

The first time we get here, eventQueue->events is NULL.
This commit is contained in:
Adam Jackson 2019-10-15 13:16:17 -04:00
parent 6fe7c43fa5
commit 9155e0c7c6

View File

@ -126,11 +126,13 @@ mieqGrowQueue(EventQueuePtr eventQueue, size_t new_nevents)
/* First copy the existing events */ /* First copy the existing events */
first_hunk = eventQueue->nevents - eventQueue->head; first_hunk = eventQueue->nevents - eventQueue->head;
memcpy(new_events, if (eventQueue->events) {
&eventQueue->events[eventQueue->head], memcpy(new_events,
first_hunk * sizeof(EventRec)); &eventQueue->events[eventQueue->head],
memcpy(&new_events[first_hunk], first_hunk * sizeof(EventRec));
eventQueue->events, eventQueue->head * sizeof(EventRec)); memcpy(&new_events[first_hunk],
eventQueue->events, eventQueue->head * sizeof(EventRec));
}
/* Initialize the new portion */ /* Initialize the new portion */
for (i = eventQueue->nevents; i < new_nevents; i++) { for (i = eventQueue->nevents; i < new_nevents; i++) {