Commit 9155e0c7 authored by Adam Jackson's avatar Adam Jackson 🥃

mi: Fix undefined memcpy in mieqGrowQueue

The first time we get here, eventQueue->events is NULL.
parent 6fe7c43f
......@@ -126,11 +126,13 @@ mieqGrowQueue(EventQueuePtr eventQueue, size_t new_nevents)
/* First copy the existing events */
first_hunk = eventQueue->nevents - eventQueue->head;
memcpy(new_events,
&eventQueue->events[eventQueue->head],
first_hunk * sizeof(EventRec));
memcpy(&new_events[first_hunk],
eventQueue->events, eventQueue->head * sizeof(EventRec));
if (eventQueue->events) {
memcpy(new_events,
&eventQueue->events[eventQueue->head],
first_hunk * sizeof(EventRec));
memcpy(&new_events[first_hunk],
eventQueue->events, eventQueue->head * sizeof(EventRec));
}
/* Initialize the new portion */
for (i = eventQueue->nevents; i < new_nevents; i++) {
......
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