Diff between cfb34d25b9a50c3efb5fee1bfcc1fa14113ddde2 and 18ce6878130b4b58551d851e87eac72aaacba20f

Changed Files

File Additions Deletions Status
obexd/plugins/bluetooth.c +9 -10 modified

Full Patch

diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
index 10f5e4f..6f6ace9 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;