use QSIMPLEQ_FOREACH_SAFE when freeing list elements

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Paolo Bonzini 2012-03-06 18:55:54 +01:00 committed by Kevin Wolf
parent b8c6f29eb8
commit 622d241998

View File

@ -736,7 +736,7 @@ void qmp_blockdev_group_snapshot_sync(SnapshotDevList *dev_list,
int ret = 0;
SnapshotDevList *dev_entry = dev_list;
SnapshotDev *dev_info = NULL;
BlkGroupSnapshotStates *states;
BlkGroupSnapshotStates *states, *next;
BlockDriver *proto_drv;
BlockDriver *drv;
int flags;
@ -842,7 +842,7 @@ delete_and_fail:
}
}
exit:
QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) {
QSIMPLEQ_FOREACH_SAFE(states, &snap_bdrv_states, entry, next) {
g_free(states);
}
return;