summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-03-04 08:46:51 +0100
committerThomas Haller <thaller@redhat.com>2016-03-04 08:47:44 +0100
commit2d6cf0df19d06149e540494bbaab7ddef37571eb (patch)
tree6f6c36153862ff0383bc69c6beea69e30a383ab5
parent1bf76b784f41424ded835587c3fe87219f41c5b2 (diff)
downloadNetworkManager-2d6cf0df19d06149e540494bbaab7ddef37571eb.tar.gz
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 }
-rw-r--r--src/devices/nm-device.c5
1 files changed, 4 insertions, 1 deletions
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)) {