mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 22:20:08 +01: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)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
||||
for (iter = priv->slaves; iter; iter = g_slist_next (iter))
|
||||
nm_device_release_one_slave (self, ((SlaveInfo *) iter->data)->slave, failed);
|
||||
g_slist_free (priv->slaves);
|
||||
priv->slaves = NULL;
|
||||
while (priv->slaves) {
|
||||
SlaveInfo *info = priv->slaves->data;
|
||||
|
||||
nm_device_release_one_slave (self, info->slave, failed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue