wireplumber/0004-module-dbus-connection-fix-GCancellable-leak.patch
Antonio Larrosa 4208d2399f - Update to version 0.5.7:
* Highlights:
    - Fixed an issue that would cause random profile switching when
      an application was trying to capture from non-Bluetooth
      devices (#715, #634, !669)
    - Fixed an issue that would cause strange profile selection
      issues [choices not being remembered or unavailable routes
      being selected] (#734)
    - Added a timer that delays switching Bluetooth headsets to the
      HSP/HFP profile, avoiding needless rapid switching when an
      application is trying to probe device capabilities instead of
      actually capturing audio (!664)
    - Improved libcamera/v4l2 device deduplication logic to work
      with more complex devices (!674, !675, #689, #708)
  * Fixes:
    - Fixed two memory leaks in module-mixer-api and
      module-dbus-connection (!672, !673)
    - Fixed a crash that could occur in module-reserve-device
      (!680, #742)
    - Fixed an issue that would cause the warning
      "[string "alsa.lua"]:182: attempt to concatenate a nil value
      (local 'node_name')" to appear in the logs when an ALSA
      device was busy, breaking node name deduplication (!681)
    - Fixed an issue that could make find-preferred-profile.lua
      crash instead of properly applying profile priority rules
      (#751)
- Remove patches that are already included in 0.5.7:
  * 0001-autoswitch-bluetooth-profile-switch-only-Bluetooth-devices.patch
  * 0002-autoswitch-bluetooth-profile-Switch-to-HSP_HFP-on-timeout.patch
  * 0003-m-mixer-api-Fix-memory-in-leak-wp_mixer_api_set_volume.patch

OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=89
2024-12-04 11:44:23 +00:00

65 lines
3.1 KiB
Diff

From ed80938b8c6a08aeb22ec4cefdee6f98c2f8e646 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= <pobrn@protonmail.com>
Date: Thu, 26 Sep 2024 14:49:12 +0200
Subject: [PATCH] module-dbus-connection: fix GCancellable leak
`wp_dbus_connection_disable()` creates a new GCancellable
object at the end, which is never freed if the GObject
is then destroyed. To fix this, override `finalize()` and
clear everything there as well.
Direct leak of 64 byte(s) in 1 object(s) allocated from:
0 0x70e688efd1aa in calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77
1 0x70e6874b3e62 in g_malloc0 (/usr/lib/libglib-2.0.so.0+0x63e62) (BuildId: 7b781c8d1a6e2161838c5d8f3bd797797c132753)
2 0x70e6875dea75 in g_type_create_instance (/usr/lib/libgobject-2.0.so.0+0x3ea75) (BuildId: 5af5e0f7d0a900ecb6083fbd71e22e5522d872e2)
3 0x70e6875c3804 (/usr/lib/libgobject-2.0.so.0+0x23804) (BuildId: 5af5e0f7d0a900ecb6083fbd71e22e5522d872e2)
4 0x70e6875c4e7e in g_object_new_with_properties (/usr/lib/libgobject-2.0.so.0+0x24e7e) (BuildId: 5af5e0f7d0a900ecb6083fbd71e22e5522d872e2)
5 0x70e6875c5ed1 in g_object_new (/usr/lib/libgobject-2.0.so.0+0x25ed1) (BuildId: 5af5e0f7d0a900ecb6083fbd71e22e5522d872e2)
6 0x70e684d2a8a6 in wp_dbus_connection_disable ../subprojects/wireplumber/modules/module-dbus-connection.c:173
7 0x70e688a833cc in wp_plugin_deactivate ../subprojects/wireplumber/lib/wp/plugin.c:144
8 0x70e688a7126c in wp_object_deactivate ../subprojects/wireplumber/lib/wp/object.c:542
9 0x70e688a6e74e in wp_object_dispose ../subprojects/wireplumber/lib/wp/object.c:191
10 0x70e6875c0f6c in g_object_unref (/usr/lib/libgobject-2.0.so.0+0x20f6c) (BuildId: 5af5e0f7d0a900ecb6083fbd71e22e5522d872e2)
11 0x70e6841f7d6d in wp_portal_permissionstore_plugin_disable ../subprojects/wireplumber/modules/module-portal-permissionstore.c:207
12 0x70e688a833cc in wp_plugin_deactivate ../subprojects/wireplumber/lib/wp/plugin.c:144
[...]
---
modules/module-dbus-connection.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/modules/module-dbus-connection.c b/modules/module-dbus-connection.c
index 21ba95a20..b337be5e1 100644
--- a/modules/module-dbus-connection.c
+++ b/modules/module-dbus-connection.c
@@ -211,6 +211,19 @@ wp_dbus_connection_set_property (GObject * object, guint property_id,
}
}
+static void
+wp_dbus_connection_finalize (GObject * object)
+{
+ WpDBusConnection *self = WP_DBUS_CONNECTION (object);
+
+ g_cancellable_cancel (self->cancellable);
+
+ g_clear_object (&self->connection);
+ g_clear_object (&self->cancellable);
+
+ G_OBJECT_CLASS (wp_dbus_connection_parent_class)->finalize (object);
+}
+
static void
wp_dbus_connection_class_init (WpDBusConnectionClass * klass)
{
@@ -219,6 +232,7 @@ wp_dbus_connection_class_init (WpDBusConnectionClass * klass)
object_class->get_property = wp_dbus_connection_get_property;
object_class->set_property = wp_dbus_connection_set_property;
+ object_class->finalize = wp_dbus_connection_finalize;
plugin_class->enable = wp_dbus_connection_enable;
plugin_class->disable = wp_dbus_connection_disable;
--
GitLab