summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Bono <alessandro.bono369@gmail.com>2023-04-29 10:26:15 +0200
committerAlessandro Bono <alessandro.bono369@gmail.com>2023-05-09 13:20:43 +0200
commit95736e372a11d00f02054906e8286b6f35cf5cd3 (patch)
tree9f85d7e8a167fdc369b5de3bfa073727f2c44abb
parent4489a20a1f437ba6f0c4415fb8a1e51d3cbba87a (diff)
downloadgdm-95736e372a11d00f02054906e8286b6f35cf5cd3.tar.gz
gdm-session-settings: Plug a leak
Fallout from f0252728e9ef2a23b0d98a4fe2c697fdc673d254. The variable was used to free the object pointed by settings->user after replacing it.
-rw-r--r--daemon/gdm-session-settings.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/daemon/gdm-session-settings.c b/daemon/gdm-session-settings.c
index 8a09381c..87a4eb1d 100644
--- a/daemon/gdm-session-settings.c
+++ b/daemon/gdm-session-settings.c
@@ -338,12 +338,15 @@ gboolean
gdm_session_settings_load (GdmSessionSettings *settings,
const char *username)
{
+ g_autoptr(ActUser) old_user = NULL;
+
g_return_val_if_fail (GDM_IS_SESSION_SETTINGS (settings), FALSE);
g_return_val_if_fail (username != NULL, FALSE);
g_return_val_if_fail (!gdm_session_settings_is_loaded (settings), FALSE);
- if (settings->user != NULL) {
- g_signal_handlers_disconnect_by_func (G_OBJECT (settings->user),
+ old_user = g_steal_pointer (&settings->user);
+ if (old_user != NULL) {
+ g_signal_handlers_disconnect_by_func (G_OBJECT (old_user),
G_CALLBACK (on_user_is_loaded_changed),
settings);
}