We need to use the foreach variant which gets the next pointer before
the loop body is executed.
Coverity-ID:
1056193
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
static void discard_events(struct libxl__event_list *l) {
/* doesn't bother unlinking from the list, so l is corrupt on return */
- libxl_event *ev;
- LIBXL_TAILQ_FOREACH(ev, l, link)
+ libxl_event *ev, *next;
+ LIBXL_TAILQ_FOREACH_SAFE(ev, l, link, next)
libxl_event_free(0, ev);
}