diff options
author | Sjoerd Simons <sjoerd@luon.net> | 2012-07-01 12:28:37 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2012-07-02 11:09:27 +0100 |
commit | 3c59b7eedbc395272c65a418fec049ae1cee0644 (patch) | |
tree | 4cc9cc60b6ec909d843e98c5a4624041656d3190 | |
parent | 733860762b4195c956de5fbd0e639c256e3eb64e (diff) | |
download | gnome-bluetooth-3c59b7eedbc395272c65a418fec049ae1cee0644.tar.gz |
Fix memory leak when registering the agent
https://bugzilla.gnome.org/show_bug.cgi?id=679240
-rw-r--r-- | 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 01273e1f..240ed0d0 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; } |