|
|
c90517 |
From eda3497315a4c6210fe77316b943483aa397e7b0 Mon Sep 17 00:00:00 2001
|
|
|
c90517 |
From: Lubomir Rintel <lkundrak@v3.sk>
|
|
|
c90517 |
Date: Mon, 18 Jun 2018 12:33:42 +0200
|
|
|
c90517 |
Subject: [PATCH 05/48] manager: avoid leaking session_id
|
|
|
c90517 |
|
|
|
c90517 |
get_login_window_session_id() duplicates the session id.
|
|
|
c90517 |
---
|
|
|
c90517 |
daemon/gdm-manager.c | 1 +
|
|
|
c90517 |
1 file changed, 1 insertion(+)
|
|
|
c90517 |
|
|
|
c90517 |
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
|
|
|
c90517 |
index a9d5628ea..71f55ec65 100644
|
|
|
c90517 |
--- a/daemon/gdm-manager.c
|
|
|
c90517 |
+++ b/daemon/gdm-manager.c
|
|
|
c90517 |
@@ -1449,60 +1449,61 @@ get_login_window_session_id (const char *seat_id,
|
|
|
c90517 |
|
|
|
c90517 |
free (service_id);
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
*session_id = NULL;
|
|
|
c90517 |
ret = FALSE;
|
|
|
c90517 |
|
|
|
c90517 |
out:
|
|
|
c90517 |
if (sessions) {
|
|
|
c90517 |
for (i = 0; sessions[i]; i ++) {
|
|
|
c90517 |
free (sessions[i]);
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
free (sessions);
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
return ret;
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
static void
|
|
|
c90517 |
activate_login_window_session_on_seat (GdmManager *self,
|
|
|
c90517 |
const char *seat_id)
|
|
|
c90517 |
{
|
|
|
c90517 |
char *session_id;
|
|
|
c90517 |
|
|
|
c90517 |
if (!get_login_window_session_id (seat_id, &session_id)) {
|
|
|
c90517 |
return;
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
activate_session_id (self, seat_id, session_id);
|
|
|
c90517 |
+ g_free (session_id);
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
static void
|
|
|
c90517 |
maybe_activate_other_session (GdmManager *self,
|
|
|
c90517 |
GdmDisplay *old_display)
|
|
|
c90517 |
{
|
|
|
c90517 |
char *seat_id = NULL;
|
|
|
c90517 |
char *session_id;
|
|
|
c90517 |
int ret;
|
|
|
c90517 |
|
|
|
c90517 |
g_object_get (G_OBJECT (old_display),
|
|
|
c90517 |
"seat-id", &seat_id,
|
|
|
c90517 |
NULL);
|
|
|
c90517 |
|
|
|
c90517 |
ret = sd_seat_get_active (seat_id, &session_id, NULL);
|
|
|
c90517 |
|
|
|
c90517 |
if (ret == 0) {
|
|
|
c90517 |
GdmDisplay *display;
|
|
|
c90517 |
|
|
|
c90517 |
display = gdm_display_store_find (self->priv->display_store,
|
|
|
c90517 |
lookup_by_session_id,
|
|
|
c90517 |
(gpointer) session_id);
|
|
|
c90517 |
|
|
|
c90517 |
if (display == NULL) {
|
|
|
c90517 |
activate_login_window_session_on_seat (self, seat_id);
|
|
|
c90517 |
}
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
g_free (seat_id);
|
|
|
c90517 |
}
|
|
|
c90517 |
--
|
|
|
c90517 |
2.26.0
|
|
|
c90517 |
|