Skip to content

Commit 84700a6

Browse files
committed
dbus: manager: move g_tree_remove() out of g_assert() in gpiodbus_id_free()
g_assert() is compiled out when G_DISABLE_ASSERT is defined, which would cause the g_tree_remove() call to disappear entirely, leading to ID leaks and eventual resource exhaustion. Move the side-effecting call outside the assertion, consistent with the pattern used elsewhere in the daemon. Fixes: a5ab76d ("dbus: add the D-Bus daemon, command-line client and tests") Assisted-by: Claude Opus 4.6 Reviewed-by: Vincent Fazio <vfazio@xes-inc.com> Tested-by: Vincent Fazio <vfazio@xes-inc.com> Link: https://patch.msgid.link/20260604-pre-2-3-fixes-v2-15-781bcaf47475@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
1 parent d7d6ae8 commit 84700a6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

dbus/manager/helpers.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ gint gpiodbus_id_alloc(GTree *id_root)
4343

4444
void gpiodbus_id_free(GTree *id_root, gint id)
4545
{
46-
g_assert(g_tree_remove(id_root, &id));
46+
gboolean removed;
47+
48+
removed = g_tree_remove(id_root, &id);
49+
g_assert(removed);
4750
}
4851

4952
gboolean

0 commit comments

Comments
 (0)