|
|
c90517 |
From d48fec7e35fb828b6ce8e0312579212a7be48c4f Mon Sep 17 00:00:00 2001
|
|
|
c90517 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
c90517 |
Date: Thu, 30 Aug 2018 13:04:56 -0400
|
|
|
c90517 |
Subject: [PATCH 22/48] common: remove unnecessary free
|
|
|
c90517 |
|
|
|
c90517 |
This commit drops an erroneous free call, that would
|
|
|
c90517 |
potentially free a dangling pointer.
|
|
|
c90517 |
|
|
|
c90517 |
Luckily the error condition can never occur because the
|
|
|
c90517 |
error code checked is never returned, so the free call
|
|
|
c90517 |
is dead code.
|
|
|
c90517 |
|
|
|
c90517 |
This commit removes the free call. A subsequent commit
|
|
|
c90517 |
will fix the error code checking.
|
|
|
c90517 |
---
|
|
|
c90517 |
common/gdm-common.c | 4 +---
|
|
|
c90517 |
1 file changed, 1 insertion(+), 3 deletions(-)
|
|
|
c90517 |
|
|
|
c90517 |
diff --git a/common/gdm-common.c b/common/gdm-common.c
|
|
|
c90517 |
index 59317a889..c909aceee 100644
|
|
|
c90517 |
--- a/common/gdm-common.c
|
|
|
c90517 |
+++ b/common/gdm-common.c
|
|
|
c90517 |
@@ -391,64 +391,62 @@ gdm_activate_session_by_id (GDBusConnection *connection,
|
|
|
c90517 |
return TRUE;
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
gboolean
|
|
|
c90517 |
gdm_get_login_window_session_id (const char *seat_id,
|
|
|
c90517 |
char **session_id)
|
|
|
c90517 |
{
|
|
|
c90517 |
gboolean ret;
|
|
|
c90517 |
int res, i;
|
|
|
c90517 |
char **sessions;
|
|
|
c90517 |
char *service_id;
|
|
|
c90517 |
char *service_class;
|
|
|
c90517 |
char *state;
|
|
|
c90517 |
|
|
|
c90517 |
res = sd_seat_get_sessions (seat_id, &sessions, NULL, NULL);
|
|
|
c90517 |
if (res < 0) {
|
|
|
c90517 |
g_debug ("Failed to determine sessions: %s", strerror (-res));
|
|
|
c90517 |
return FALSE;
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
if (sessions == NULL || sessions[0] == NULL) {
|
|
|
c90517 |
*session_id = NULL;
|
|
|
c90517 |
ret = FALSE;
|
|
|
c90517 |
goto out;
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
for (i = 0; sessions[i]; i ++) {
|
|
|
c90517 |
|
|
|
c90517 |
res = sd_session_get_class (sessions[i], &service_class);
|
|
|
c90517 |
if (res < 0) {
|
|
|
c90517 |
- if (res == -ENOENT) {
|
|
|
c90517 |
- free (service_class);
|
|
|
c90517 |
+ if (res == -ENOENT)
|
|
|
c90517 |
continue;
|
|
|
c90517 |
- }
|
|
|
c90517 |
|
|
|
c90517 |
g_debug ("failed to determine class of session %s: %s", sessions[i], strerror (-res));
|
|
|
c90517 |
ret = FALSE;
|
|
|
c90517 |
goto out;
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
if (strcmp (service_class, "greeter") != 0) {
|
|
|
c90517 |
free (service_class);
|
|
|
c90517 |
continue;
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
free (service_class);
|
|
|
c90517 |
|
|
|
c90517 |
ret = sd_session_get_state (sessions[i], &state);
|
|
|
c90517 |
if (ret < 0) {
|
|
|
c90517 |
g_debug ("failed to determine state of session %s: %s", sessions[i], strerror (-res));
|
|
|
c90517 |
ret = FALSE;
|
|
|
c90517 |
goto out;
|
|
|
c90517 |
}
|
|
|
c90517 |
|
|
|
c90517 |
if (g_strcmp0 (state, "closing") == 0) {
|
|
|
c90517 |
free (state);
|
|
|
c90517 |
continue;
|
|
|
c90517 |
}
|
|
|
c90517 |
free (state);
|
|
|
c90517 |
|
|
|
c90517 |
res = sd_session_get_service (sessions[i], &service_id);
|
|
|
c90517 |
if (res < 0) {
|
|
|
c90517 |
g_debug ("failed to determine service of session %s: %s", sessions[i], strerror (-res));
|
|
|
c90517 |
ret = FALSE;
|
|
|
c90517 |
--
|
|
|
c90517 |
2.26.0
|
|
|
c90517 |
|