From 0684f4d2d25fec373e025a200dc025d6a15d4350 Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Tue, 7 Jul 2026 13:28:12 +0200 Subject: [PATCH] Fix a memory leak in session state changes Resolves: RHEL-187078 Signed-off-by: Siteshwar Vashisht --- polkit-0.115-state-data-memleak.patch | 22 ++++++++++++++++++++++ polkit.spec | 7 ++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 polkit-0.115-state-data-memleak.patch diff --git a/polkit-0.115-state-data-memleak.patch b/polkit-0.115-state-data-memleak.patch new file mode 100644 index 0000000..0f9dd19 --- /dev/null +++ b/polkit-0.115-state-data-memleak.patch @@ -0,0 +1,22 @@ +diff --git a/src/polkit/polkitpermission.c b/src/polkit/polkitpermission.c +index 3231bf2..984771e 100644 +--- a/src/polkit/polkitpermission.c ++++ b/src/polkit/polkitpermission.c +@@ -554,7 +554,7 @@ static void on_sessions_changed (PolkitAuthority *authority, + if ((new_session_state == NULL) || ( g_strcmp0(new_session_state, permission->session_state) != 0 )) + { + last_state = permission->session_state; +- permission->session_state = new_session_state; ++ permission->session_state = g_steal_pointer (&new_session_state); + g_free(last_state); + + polkit_authority_check_authorization (permission->authority, +@@ -566,6 +566,8 @@ static void on_sessions_changed (PolkitAuthority *authority, + changed_check_cb, + g_object_ref (permission)); + } ++ ++ g_free (new_session_state); + #else + on_authority_changed(authority, user_data); /* TODO: resolve the "too many session signals" issue for non-systemd systems later */ + #endif diff --git a/polkit.spec b/polkit.spec index 498e70f..eda29fc 100644 --- a/polkit.spec +++ b/polkit.spec @@ -6,7 +6,7 @@ Summary: An authorization framework Name: polkit Version: 0.115 -Release: 15%{?dist}.2 +Release: 15%{?dist}.3 License: LGPLv2+ URL: http://www.freedesktop.org/wiki/Software/polkit Source0: http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz @@ -31,6 +31,7 @@ Patch14: polkit-0.115-CVE-2021-4115.patch Patch15: polkit-0.115-tty-flags-restore-if-changed.patch Patch16: polkit-0.115-session-monitor-watch-sessions-only.patch Patch17: polkit-0.115-pkperm-watch-real-ssn-changes.patch +Patch18: polkit-0.115-state-data-memleak.patch BuildRequires: gcc-c++ @@ -197,6 +198,10 @@ exit 0 %{_libdir}/girepository-1.0/*.typelib %changelog +* Tue Jul 07 2026 Siteshwar Vashisht - 0.115-15.3 +- Fix a memory leak in session state changes +- Resolves: RHEL-187078 + * Mon May 20 2024 Jan Rybar - 0.115-15.2 - PolkitPermission re-check on real session changes - Resolves: RHEL-34029