mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 12:40:11 +01:00
Merge: fix some memory leaks (bgo #739013)
https://bugzilla.gnome.org/show_bug.cgi?id=739013
This commit is contained in:
commit
d7bee60ed7
4 changed files with 22 additions and 6 deletions
|
|
@ -1924,6 +1924,7 @@ nm_connection_private_free (NMConnectionPrivate *priv)
|
|||
|
||||
g_hash_table_foreach_remove (priv->settings, _setting_release, self);
|
||||
g_hash_table_destroy (priv->settings);
|
||||
g_free (priv->path);
|
||||
|
||||
g_slice_free (NMConnectionPrivate, priv);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -823,6 +823,7 @@ _nm_setting_new_from_dbus (GType setting_type,
|
|||
g_value_init (&object_value, property->param_spec->value_type);
|
||||
set_property_from_dbus (property, value, &object_value);
|
||||
g_object_set_property (G_OBJECT (setting), property->param_spec->name, &object_value);
|
||||
g_value_unset (&object_value);
|
||||
}
|
||||
|
||||
if (value)
|
||||
|
|
|
|||
|
|
@ -108,8 +108,10 @@ on_name_owner_changed (GObject *proxy,
|
|||
NMObject *self = NM_OBJECT (user_data);
|
||||
NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self);
|
||||
gboolean now_running;
|
||||
char *owner;
|
||||
|
||||
now_running = (g_dbus_proxy_get_name_owner (priv->properties_proxy) != NULL);
|
||||
now_running = ((owner = g_dbus_proxy_get_name_owner (priv->properties_proxy)) != NULL);
|
||||
g_free (owner);
|
||||
if (now_running != priv->nm_running) {
|
||||
priv->nm_running = now_running;
|
||||
g_object_notify (G_OBJECT (self), NM_OBJECT_NM_RUNNING);
|
||||
|
|
@ -128,11 +130,13 @@ static void
|
|||
init_dbus (NMObject *object)
|
||||
{
|
||||
NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object);
|
||||
char *owner;
|
||||
|
||||
if (_nm_dbus_is_connection_private (priv->connection))
|
||||
priv->nm_running = TRUE;
|
||||
else {
|
||||
priv->nm_running = (g_dbus_proxy_get_name_owner (priv->properties_proxy) != NULL);
|
||||
priv->nm_running = ((owner = g_dbus_proxy_get_name_owner (priv->properties_proxy)) != NULL);
|
||||
g_free (owner);
|
||||
g_signal_connect (priv->properties_proxy, "notify::g-name-owner",
|
||||
G_CALLBACK (on_name_owner_changed), object);
|
||||
}
|
||||
|
|
@ -1192,7 +1196,7 @@ process_properties_changed (NMObject *self, GVariant *properties, gboolean synch
|
|||
return;
|
||||
|
||||
g_variant_iter_init (&iter, properties);
|
||||
while (g_variant_iter_next (&iter, "{sv}", &name, &value))
|
||||
while (g_variant_iter_next (&iter, "{&sv}", &name, &value))
|
||||
handle_property_changed (self, name, value, synchronously);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,10 +124,13 @@ name_owner_changed (GObject *proxy,
|
|||
NMSecretAgent *self = NM_SECRET_AGENT (user_data);
|
||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
char *owner;
|
||||
|
||||
if (g_dbus_proxy_get_name_owner (G_DBUS_PROXY (proxy)) != NULL) {
|
||||
owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (proxy));
|
||||
if (owner != NULL) {
|
||||
if (should_auto_register (self))
|
||||
nm_secret_agent_register_async (self, NULL, NULL, NULL);
|
||||
g_free (owner);
|
||||
} else {
|
||||
/* Cancel any pending secrets requests */
|
||||
for (iter = priv->pending_gets; iter; iter = g_slist_next (iter)) {
|
||||
|
|
@ -150,7 +153,7 @@ verify_sender (NMSecretAgent *self,
|
|||
GError **error)
|
||||
{
|
||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
||||
const char *nm_owner;
|
||||
char *nm_owner;
|
||||
const char *sender;
|
||||
guint32 sender_uid;
|
||||
GVariant *ret;
|
||||
|
|
@ -181,6 +184,7 @@ verify_sender (NMSecretAgent *self,
|
|||
NM_SECRET_AGENT_ERROR,
|
||||
NM_SECRET_AGENT_ERROR_PERMISSION_DENIED,
|
||||
"Failed to get request sender.");
|
||||
g_free (nm_owner);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -190,8 +194,10 @@ verify_sender (NMSecretAgent *self,
|
|||
NM_SECRET_AGENT_ERROR,
|
||||
NM_SECRET_AGENT_ERROR_PERMISSION_DENIED,
|
||||
"Request sender does not match NetworkManager bus name owner.");
|
||||
g_free (nm_owner);
|
||||
return FALSE;
|
||||
}
|
||||
g_free (nm_owner);
|
||||
|
||||
/* If we're connected to the session bus, then this must be a test program,
|
||||
* so skip the UID check.
|
||||
|
|
@ -470,11 +476,15 @@ static gboolean
|
|||
check_nm_running (NMSecretAgent *self, GError **error)
|
||||
{
|
||||
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
|
||||
char *owner;
|
||||
|
||||
if (priv->private_bus)
|
||||
return TRUE;
|
||||
if (g_dbus_proxy_get_name_owner (G_DBUS_PROXY (priv->manager_proxy)))
|
||||
owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (priv->manager_proxy));
|
||||
if (owner) {
|
||||
g_free (owner);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_set_error (error, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_FAILED,
|
||||
"NetworkManager is not running");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue