From 27d9260ce5df97e4f073e59b87bf6a6ce656b601 Mon Sep 17 00:00:00 2001 From: Mikel Astiz Date: Wed, 29 May 2013 14:38:23 +0200 Subject: [PATCH] cyclingspeed: Fix D-Bus registration error case If g_dbus_register_interface() fails, the struct csc_adapter memory will be freed and therefore the csc_adapters list cannot contain such an invalid pointer. --- profiles/cyclingspeed/cyclingspeed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles/cyclingspeed/cyclingspeed.c b/profiles/cyclingspeed/cyclingspeed.c index 76be23466..ea6076ca4 100644 --- a/profiles/cyclingspeed/cyclingspeed.c +++ b/profiles/cyclingspeed/cyclingspeed.c @@ -964,8 +964,6 @@ static int csc_adapter_probe(struct btd_profile *p, struct btd_adapter *adapter) cadapter = g_new0(struct csc_adapter, 1); cadapter->adapter = adapter; - csc_adapters = g_slist_prepend(csc_adapters, cadapter); - if (!g_dbus_register_interface(btd_get_dbus_connection(), adapter_get_path(adapter), CYCLINGSPEED_MANAGER_INTERFACE, @@ -978,6 +976,8 @@ static int csc_adapter_probe(struct btd_profile *p, struct btd_adapter *adapter) return -EIO; } + csc_adapters = g_slist_prepend(csc_adapters, cadapter); + return 0; } -- 2.47.3