summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-11-05 16:19:01 +0100
committerLubomir Rintel <lkundrak@v3.sk>2015-11-10 16:48:17 +0100
commit833e126cf8beb7db8ea319606557d0fb963d5f7f (patch)
tree1cbbbfbfda260a3aa69b0835502e6d861fb7eeb4 /src
parentcaa2de563defefea6bcb182080e625b72257e1c0 (diff)
downloadNetworkManager-833e126cf8beb7db8ea319606557d0fb963d5f7f.tar.gz
device: avoid removing a list element while iterating it
Diffstat (limited to 'src')
-rw-r--r--src/devices/nm-device.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index e2adf86799..bc10379890 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -8559,12 +8559,13 @@ gboolean
nm_device_remove_pending_action (NMDevice *self, const char *action, gboolean assert_is_pending)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
- GSList *iter;
+ GSList *iter, *next;
guint count = 0;
g_return_val_if_fail (action, FALSE);
- for (iter = priv->pending_actions; iter; iter = iter->next) {
+ for (iter = priv->pending_actions; iter; iter = next) {
+ next = iter->next;
if (!strcmp (action, iter->data)) {
_LOGD (LOGD_DEVICE, "remove_pending_action (%d): '%s'",
count + g_slist_length (iter->next), /* length excluding 'iter' */