Skip to content

Commit 30648dd

Browse files
committed
qemu-option: Allow deleting opts during qemu_opts_foreach()
Use QTAILQ_FOREACH_SAFE() so that the current QemuOpts can be deleted while iterating through the whole list. Signed-off-by: Kevin Wolf <[email protected]> Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Tested-by: Peter Krempa <[email protected]> Signed-off-by: Kevin Wolf <[email protected]>
1 parent 4a1d937 commit 30648dd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

util/qemu-option.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,11 +1126,11 @@ int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func,
11261126
void *opaque, Error **errp)
11271127
{
11281128
Location loc;
1129-
QemuOpts *opts;
1129+
QemuOpts *opts, *next;
11301130
int rc = 0;
11311131

11321132
loc_push_none(&loc);
1133-
QTAILQ_FOREACH(opts, &list->head, next) {
1133+
QTAILQ_FOREACH_SAFE(opts, &list->head, next, next) {
11341134
loc_restore(&opts->loc);
11351135
rc = func(opaque, opts, errp);
11361136
if (rc) {

0 commit comments

Comments
 (0)