[gnome-bluetooth] lib: return early in BluetoothAgent in case of errors



commit 0d920a03f51ba7279c874ed836cedc5bb797a7e3
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Thu Sep 6 21:14:38 2012 +0200

    lib: return early in BluetoothAgent in case of errors
    
    Prevents a warning from unreffing a NULL variant.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683523

 lib/bluetooth-agent.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/lib/bluetooth-agent.c b/lib/bluetooth-agent.c
index 240ed0d..f8b5cd0 100644
--- a/lib/bluetooth-agent.c
+++ b/lib/bluetooth-agent.c
@@ -468,6 +468,7 @@ gboolean bluetooth_agent_register(BluetoothAgent *agent)
 		g_warning ("Failed to register object: %s", error->message);
 		g_error_free (error);
 		error = NULL;
+		return FALSE;
 	}
 
 	r = g_dbus_proxy_call_sync (priv->adapter, "RegisterAgent",
@@ -477,6 +478,7 @@ gboolean bluetooth_agent_register(BluetoothAgent *agent)
 	if (r == NULL) {
 		g_printerr ("Agent registration failed: %s\n", error->message);
 		g_error_free (error);
+		return FALSE;
 	}
 	g_variant_unref (r);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]