ui/dbus: fix leak on message filtering

A filter function that wants to drop a message should return NULL, in
which case it must also unref the message itself.

Fixes: fa88b85de ("ui/dbus: filter out pending messages when scanout")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-ID: <20241008125028.1177932-4-marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2024-10-08 16:50:12 +04:00
parent 6d6e23361f
commit 244d52ff73

View File

@ -1001,6 +1001,7 @@ dbus_filter(GDBusConnection *connection,
serial = g_dbus_message_get_serial(message); serial = g_dbus_message_get_serial(message);
if (serial <= ddl->out_serial_to_discard) { if (serial <= ddl->out_serial_to_discard) {
trace_dbus_filter(serial, ddl->out_serial_to_discard); trace_dbus_filter(serial, ddl->out_serial_to_discard);
g_object_unref(message);
return NULL; return NULL;
} }