mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 23:50:10 +01:00
bus-manager: don't leak connections
The bus manager takes extra references to the GDBusConnection every time g_dbus_object_manager_server_get_connection() its called, preventing its disposal once the connection is closed. This causes a leak for each DHCP event. https://bugzilla.redhat.com/show_bug.cgi?id=1461643 (cherry picked from commit5b81d40338) (cherry picked from commitbb4b6be912) (cherry picked from commit44cbd3b036)
This commit is contained in:
parent
6facaef7ac
commit
202ee6d1a3
1 changed files with 13 additions and 3 deletions
|
|
@ -164,7 +164,10 @@ close_connection_in_idle (gpointer user_data)
|
|||
|
||||
g_hash_table_iter_init (&iter, server->obj_managers);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer) &manager, NULL)) {
|
||||
if (g_dbus_object_manager_server_get_connection (manager) == info->connection) {
|
||||
gs_unref_object GDBusConnection *connection = NULL;
|
||||
|
||||
connection = g_dbus_object_manager_server_get_connection (manager);
|
||||
if (connection == info->connection) {
|
||||
g_hash_table_iter_remove (&iter);
|
||||
break;
|
||||
}
|
||||
|
|
@ -243,6 +246,7 @@ private_server_manager_destroy (GDBusObjectManagerServer *manager)
|
|||
g_dbus_connection_close (connection, NULL, NULL, NULL);
|
||||
g_dbus_object_manager_server_set_connection (manager, NULL);
|
||||
g_object_unref (manager);
|
||||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
@ -361,7 +365,10 @@ private_server_get_connection_owner (PrivateServer *s, GDBusConnection *connecti
|
|||
|
||||
g_hash_table_iter_init (&iter, s->obj_managers);
|
||||
while (g_hash_table_iter_next (&iter, (gpointer) &manager, (gpointer) &owner)) {
|
||||
if (g_dbus_object_manager_server_get_connection (manager) == connection)
|
||||
gs_unref_object GDBusConnection *c = NULL;
|
||||
|
||||
c = g_dbus_object_manager_server_get_connection (manager);
|
||||
if (c == connection)
|
||||
return owner;
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -599,7 +606,10 @@ nm_bus_manager_get_unix_user (NMBusManager *self,
|
|||
|
||||
/* Check if it's a private connection sender, which we fake */
|
||||
for (iter = priv->private_servers; iter; iter = iter->next) {
|
||||
if (private_server_get_connection_by_owner (iter->data, sender)) {
|
||||
gs_unref_object GDBusConnection *connection = NULL;
|
||||
|
||||
connection = private_server_get_connection_by_owner (iter->data, sender);
|
||||
if (connection) {
|
||||
*out_uid = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue