From: Luiz Augusto von Dentz Date: Tue, 10 Sep 2013 11:38:55 +0000 (+0300) Subject: obexd/bluetooth: Fix error on register_profile X-Git-Tag: android-x86-4.4-r3~7651 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=18ce6878130b4b58551d851e87eac72aaacba20f;p=android-x86%2Fexternal-bluetooth-bluez.git obexd/bluetooth: Fix error on register_profile The error happens whenever RegisterProfile fails the interface is not unregistered causing any subsequent call to register_profile function to fail: obexd[944]: D-Bus failed to register /org/bluez/obex/00005005_0000_1000_8000_0002ee000001 obexd[944]: bluetooth: Failed to register profile (null) --- diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c index 10f5e4fc2..6f6ace90e 100644 --- a/obexd/plugins/bluetooth.c +++ b/obexd/plugins/bluetooth.c @@ -185,6 +185,14 @@ static const GDBusMethodTable profile_methods[] = { { } }; +static void unregister_profile(struct bluetooth_profile *profile) +{ + g_dbus_unregister_interface(connection, profile->path, + "org.bluez.Profile1"); + g_free(profile->path); + profile->path = NULL; +} + static void register_profile_reply(DBusPendingCall *call, void *user_data) { struct bluetooth_profile *profile = user_data; @@ -198,8 +206,7 @@ static void register_profile_reply(DBusPendingCall *call, void *user_data) goto done; } - g_free(profile->path); - profile->path = NULL; + unregister_profile(profile); error("bluetooth: RequestProfile error: %s, %s", derr.name, derr.message); @@ -208,14 +215,6 @@ done: dbus_message_unref(reply); } -static void unregister_profile(struct bluetooth_profile *profile) -{ - g_dbus_unregister_interface(connection, profile->path, - "org.bluez.Profile1"); - g_free(profile->path); - profile->path = NULL; -} - static void profile_free(void *data) { struct bluetooth_profile *profile = data;