Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/5] service: Fix not unreferencing adapter in case of error
@ 2012-11-26  9:07 Szymon Janc
  2012-11-26  9:07 ` [PATCH 2/5] service: Remove not needed initialization Szymon Janc
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Szymon Janc @ 2012-11-26  9:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

If g_dbus_register_interface failed adapter reference was not dropped.
Move getting reference after succesful g_dbus_register_interface call.
---
 plugins/service.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugins/service.c b/plugins/service.c
index ba7a693..d70c515 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -509,9 +509,6 @@ static int register_interface(const char *path, struct btd_adapter *adapter)
 	if (serv_adapter == NULL)
 		return -ENOMEM;
 
-	if (adapter != NULL)
-		serv_adapter->adapter = btd_adapter_ref(adapter);
-
 	serv_adapter->pending_list = NULL;
 
 	if (g_dbus_register_interface(btd_get_dbus_connection(),
@@ -520,13 +517,16 @@ static int register_interface(const char *path, struct btd_adapter *adapter)
 						path_unregister) == FALSE) {
 		error("D-Bus failed to register %s interface",
 							SERVICE_INTERFACE);
+
 		g_free(serv_adapter);
 		return -EIO;
 	}
 
 	DBG("Registered interface %s on path %s", SERVICE_INTERFACE, path);
 
-	if (serv_adapter->adapter == NULL)
+	if (adapter != NULL)
+		serv_adapter->adapter = btd_adapter_ref(adapter);
+	else
 		serv_adapter_any = serv_adapter;
 
 	return 0;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-11-26 12:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-26  9:07 [PATCH 1/5] service: Fix not unreferencing adapter in case of error Szymon Janc
2012-11-26  9:07 ` [PATCH 2/5] service: Remove not needed initialization Szymon Janc
2012-11-26  9:07 ` [PATCH 3/5] adapter: Call driver remove callback when unregistering driver Szymon Janc
2012-11-26  9:07 ` [PATCH 4/5] adaptername: Remove not needed empty remove callback Szymon Janc
2012-11-26 10:45   ` Anderson Lizardo
2012-11-26 10:52     ` Szymon Janc
2012-11-26 11:26       ` Johan Hedberg
2012-11-26 12:57       ` Anderson Lizardo
2012-11-26  9:07 ` [PATCH 5/5] formfactor: " Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox