mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-25 04:30:02 +00:00
spapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events()
QTAILQ_FOREACH_SAFE() must be used when removing the current element
inside the loop block.
This fixes a user-after-free error introduced by commit 5625817423
and reported by Coverity (CID 1381017).
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
3b2fcedd52
commit
d492a75cfe
@ -702,9 +702,9 @@ static void event_scan(PowerPCCPU *cpu, sPAPRMachineState *spapr,
|
||||
|
||||
void spapr_clear_pending_events(sPAPRMachineState *spapr)
|
||||
{
|
||||
sPAPREventLogEntry *entry = NULL;
|
||||
sPAPREventLogEntry *entry = NULL, *next_entry;
|
||||
|
||||
QTAILQ_FOREACH(entry, &spapr->pending_events, next) {
|
||||
QTAILQ_FOREACH_SAFE(entry, &spapr->pending_events, next, next_entry) {
|
||||
QTAILQ_REMOVE(&spapr->pending_events, entry, next);
|
||||
g_free(entry->extended_log);
|
||||
g_free(entry);
|
||||
|
Loading…
Reference in New Issue
Block a user