[gnome-bluetooth] lib: properly free resources in create_device_callback ()
- From: Daniele Forsi <dforsi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] lib: properly free resources in create_device_callback ()
- Date: Fri, 25 Nov 2011 10:41:21 +0000 (UTC)
commit 4e48826d350f187e04da5b0556222a82d7662e0c
Author: Daniele Forsi <dforsi src gnome org>
Date: Thu Nov 24 18:36:38 2011 +0100
lib: properly free resources in create_device_callback ()
Plugs memleak of "path" and fixes object/variant mismatch:
GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
lib/bluetooth-client.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 4ff6aeb..ccc7659 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1484,20 +1484,18 @@ create_device_callback (GDBusProxy *proxy,
ret = g_dbus_proxy_call_finish (proxy, res, &error);
if (ret == NULL) {
g_warning ("CreateDevice failed: %s", error->message);
- path = NULL;
} else {
g_variant_get (ret, "(o)", &path);
+ g_variant_unref (ret);
}
if (devdata->func)
devdata->func(devdata->client, path, error, devdata->data);
+ g_free (path);
if (error != NULL)
g_error_free (error);
-
- if (ret != NULL)
- g_object_unref (ret);
g_object_unref (devdata->client);
g_free (devdata);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]