[gnome-bluetooth/gnome-3-4] Fix memory leak when registering the agent



commit e66c4fe9f915d5952a2b16eabbc4ac2bafce7455
Author: Sjoerd Simons <sjoerd luon net>
Date:   Sun Jul 1 12:28:37 2012 +0200

    Fix memory leak when registering the agent
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679240

 lib/bluetooth-agent.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/lib/bluetooth-agent.c b/lib/bluetooth-agent.c
index 01273e1..240ed0d 100644
--- a/lib/bluetooth-agent.c
+++ b/lib/bluetooth-agent.c
@@ -437,6 +437,7 @@ gboolean bluetooth_agent_register(BluetoothAgent *agent)
 	BluetoothAgentPrivate *priv;
 	GError *error = NULL;
 	char *path;
+	GVariant *r;
 
 	g_return_val_if_fail (BLUETOOTH_IS_AGENT (agent), FALSE);
 
@@ -469,13 +470,15 @@ gboolean bluetooth_agent_register(BluetoothAgent *agent)
 		error = NULL;
 	}
 
-	if (g_dbus_proxy_call_sync (priv->adapter, "RegisterAgent",
+	r = g_dbus_proxy_call_sync (priv->adapter, "RegisterAgent",
 				    g_variant_new ("(os)", priv->path, "DisplayYesNo"),
 				    G_DBUS_CALL_FLAGS_NONE,
-				    -1, NULL, &error) == FALSE) {
+				    -1, NULL, &error);
+	if (r == NULL) {
 		g_printerr ("Agent registration failed: %s\n", error->message);
 		g_error_free (error);
 	}
+	g_variant_unref (r);
 
 	return TRUE;
 }



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