libnm: more valgrinding fixes

This commit is contained in:
Dan Winship
2013-10-03 09:57:01 -04:00
parent 28e67c7d73
commit cbe261caa2
6 changed files with 20 additions and 7 deletions

View File

@@ -501,7 +501,7 @@ static void
recheck_pending_activations (NMClient *self, const char *failed_path, GError *error) recheck_pending_activations (NMClient *self, const char *failed_path, GError *error)
{ {
NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (self); NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (self);
GSList *iter; GSList *iter, *next;
const GPtrArray *active_connections; const GPtrArray *active_connections;
gboolean found_in_active = FALSE; gboolean found_in_active = FALSE;
gboolean found_in_pending = FALSE; gboolean found_in_pending = FALSE;
@@ -516,9 +516,11 @@ recheck_pending_activations (NMClient *self, const char *failed_path, GError *er
* If the connection to activate doesn't make it to active_connections, * If the connection to activate doesn't make it to active_connections,
* due to an error, we have to call the callback for failed_path. * due to an error, we have to call the callback for failed_path.
*/ */
for (iter = priv->pending_activations; iter; iter = g_slist_next (iter)) { for (iter = priv->pending_activations; iter; iter = next) {
ActivateInfo *info = iter->data; ActivateInfo *info = iter->data;
next = g_slist_next (iter);
if (!found_in_pending && failed_path && g_strcmp0 (failed_path, info->active_path) == 0) { if (!found_in_pending && failed_path && g_strcmp0 (failed_path, info->active_path) == 0) {
found_in_pending = TRUE; found_in_pending = TRUE;
ainfo = info; ainfo = info;

View File

@@ -204,6 +204,7 @@ finalize (GObject *object)
NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (object); NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (object);
g_free (priv->hw_address); g_free (priv->hw_address);
g_free (priv->type_description);
G_OBJECT_CLASS (nm_device_generic_parent_class)->finalize (object); G_OBJECT_CLASS (nm_device_generic_parent_class)->finalize (object);
} }

View File

@@ -226,6 +226,11 @@ device_state_change_reloaded (GObject *object,
NMDevice *self = NM_DEVICE (object); NMDevice *self = NM_DEVICE (object);
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
StateChangeData *data = user_data; StateChangeData *data = user_data;
NMDeviceState old_state = data->old_state;
NMDeviceState new_state = data->new_state;
NMDeviceStateReason reason = data->reason;
g_slice_free (StateChangeData, data);
_nm_object_reload_properties_finish (NM_OBJECT (object), result, NULL); _nm_object_reload_properties_finish (NM_OBJECT (object), result, NULL);
@@ -234,17 +239,16 @@ device_state_change_reloaded (GObject *object,
* they'll finish in the right order. In that case, only emit the signal * they'll finish in the right order. In that case, only emit the signal
* for the last one. * for the last one.
*/ */
if (priv->last_seen_state != data->new_state) if (priv->last_seen_state != new_state)
return; return;
/* Ensure that nm_device_get_state() will return the right value even if /* Ensure that nm_device_get_state() will return the right value even if
* we haven't processed the corresponding PropertiesChanged yet. * we haven't processed the corresponding PropertiesChanged yet.
*/ */
priv->state = data->new_state; priv->state = new_state;
g_signal_emit (self, signals[STATE_CHANGED], 0, g_signal_emit (self, signals[STATE_CHANGED], 0,
data->new_state, data->old_state, data->reason); new_state, old_state, reason);
g_slice_free (StateChangeData, data);
} }
static void static void
@@ -384,6 +388,7 @@ finalize (GObject *object)
g_free (priv->firmware_version); g_free (priv->firmware_version);
g_free (priv->product); g_free (priv->product);
g_free (priv->vendor); g_free (priv->vendor);
g_free (priv->type_description);
G_OBJECT_CLASS (nm_device_parent_class)->finalize (object); G_OBJECT_CLASS (nm_device_parent_class)->finalize (object);
} }

View File

@@ -741,8 +741,10 @@ add_to_object_array_unique (GPtrArray *array, GObject *obj)
if (obj != NULL) { if (obj != NULL) {
for (i = 0; i < array->len; i++) { for (i = 0; i < array->len; i++) {
if (g_ptr_array_index (array, i) == obj) if (g_ptr_array_index (array, i) == obj) {
g_object_unref (obj);
return; return;
}
} }
g_ptr_array_add (array, obj); g_ptr_array_add (array, obj);
} }

View File

@@ -870,6 +870,7 @@ finalize (GObject *object)
g_free (priv->master); g_free (priv->master);
g_free (priv->slave_type); g_free (priv->slave_type);
g_slist_free_full (priv->permissions, (GDestroyNotify) permission_free); g_slist_free_full (priv->permissions, (GDestroyNotify) permission_free);
g_slist_free_full (priv->secondaries, g_free);
G_OBJECT_CLASS (nm_setting_connection_parent_class)->finalize (object); G_OBJECT_CLASS (nm_setting_connection_parent_class)->finalize (object);
} }

View File

@@ -656,6 +656,8 @@ finalize (GObject *object)
g_free (priv->parent); g_free (priv->parent);
g_slist_free_full (priv->ingress_priority_map, g_free); g_slist_free_full (priv->ingress_priority_map, g_free);
g_slist_free_full (priv->egress_priority_map, g_free); g_slist_free_full (priv->egress_priority_map, g_free);
G_OBJECT_CLASS (nm_setting_vlan_parent_class)->finalize (object);
} }
static void static void