From 2d6cf0df19d06149e540494bbaab7ddef37571eb Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 4 Mar 2016 08:46:51 +0100 Subject: [PATCH] device: assert for valid device argument in nm_device_remove_pending_action() Coverity complains in nm-active-connection.c: 996 if (priv->pending_activation_id) { CID 59368 (#1 of 1): Dereference after null check (FORWARD_NULL)4. var_deref_model: Passing null pointer priv->device to nm_device_remove_pending_action, which dereferences it. [show details] 997 nm_device_remove_pending_action (priv->device, priv->pending_activation_id, TRUE); 998 g_clear_pointer (&priv->pending_activation_id, g_free); 999 } --- src/devices/nm-device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 0897b27e55..c062e88f81 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -9838,12 +9838,15 @@ nm_device_add_pending_action (NMDevice *self, const char *action, gboolean asser gboolean nm_device_remove_pending_action (NMDevice *self, const char *action, gboolean assert_is_pending) { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + NMDevicePrivate *priv; GSList *iter, *next; guint count = 0; + g_return_val_if_fail (self, FALSE); g_return_val_if_fail (action, FALSE); + priv = NM_DEVICE_GET_PRIVATE (self); + for (iter = priv->pending_actions; iter; iter = next) { next = iter->next; if (!strcmp (action, iter->data)) {