mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 10:08:05 +02:00
core: fix list manipulation when removing multiple slaves
nm_device_release_one_slave() may change the list head, but the for loop in nm_device_master_release_slaves() can't handle that. Use a while loop instead.
This commit is contained in:
parent
7d12ede07b
commit
4ca885f5e3
1 changed files with 5 additions and 5 deletions
|
|
@ -1121,12 +1121,12 @@ static void
|
||||||
nm_device_master_release_slaves (NMDevice *self, gboolean failed)
|
nm_device_master_release_slaves (NMDevice *self, gboolean failed)
|
||||||
{
|
{
|
||||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||||
GSList *iter;
|
|
||||||
|
|
||||||
for (iter = priv->slaves; iter; iter = g_slist_next (iter))
|
while (priv->slaves) {
|
||||||
nm_device_release_one_slave (self, ((SlaveInfo *) iter->data)->slave, failed);
|
SlaveInfo *info = priv->slaves->data;
|
||||||
g_slist_free (priv->slaves);
|
|
||||||
priv->slaves = NULL;
|
nm_device_release_one_slave (self, info->slave, failed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue