* [PATCH 2/4] cups: Fix D-Bus reply memory leaks
2011-12-06 14:59 [PATCH 1/4] telephony-maemo5: Fix D-Bus reply memory leaks Syam Sidhardhan
@ 2011-12-06 14:59 ` Syam Sidhardhan
2011-12-06 14:59 ` [PATCH 3/4] agent: " Syam Sidhardhan
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Syam Sidhardhan @ 2011-12-06 14:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Syam Sidhardhan
---
cups/main.c | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/cups/main.c b/cups/main.c
index 7f3f4b0..a884c6e 100644
--- a/cups/main.c
+++ b/cups/main.c
@@ -348,10 +348,15 @@ static void remote_device_found(const char *adapter, const char *bdaddr,
dbus_message_unref(message);
+ if (!adapter_reply)
+ return;
+
if (dbus_message_get_args(adapter_reply, NULL,
DBUS_TYPE_OBJECT_PATH, &adapter,
- DBUS_TYPE_INVALID) == FALSE)
+ DBUS_TYPE_INVALID) == FALSE) {
+ dbus_message_unref(adapter_reply);
return;
+ }
}
message = dbus_message_new_method_call("org.bluez", adapter,
@@ -386,12 +391,16 @@ static void remote_device_found(const char *adapter, const char *bdaddr,
if (dbus_message_get_args(reply, NULL,
DBUS_TYPE_OBJECT_PATH, &object_path,
- DBUS_TYPE_INVALID) == FALSE)
+ DBUS_TYPE_INVALID) == FALSE) {
+ dbus_message_unref(reply);
return;
+ }
id = device_get_ieee1284_id(adapter, object_path);
add_device_to_list(name, bdaddr, id);
g_free(id);
+
+ dbus_message_unref(reply);
}
static void discovery_completed(void)
@@ -642,10 +651,15 @@ static gboolean print_ieee1284(const char *bdaddr)
dbus_message_unref(message);
+ if (!adapter_reply)
+ return FALSE;
+
if (dbus_message_get_args(adapter_reply, NULL,
DBUS_TYPE_OBJECT_PATH, &adapter,
- DBUS_TYPE_INVALID) == FALSE)
+ DBUS_TYPE_INVALID) == FALSE) {
+ dbus_message_unref(adapter_reply);
return FALSE;
+ }
message = dbus_message_new_method_call("org.bluez", adapter,
"org.bluez.Adapter",
@@ -680,15 +694,21 @@ static gboolean print_ieee1284(const char *bdaddr)
if (dbus_message_get_args(reply, NULL,
DBUS_TYPE_OBJECT_PATH, &object_path,
- DBUS_TYPE_INVALID) == FALSE)
+ DBUS_TYPE_INVALID) == FALSE) {
+ dbus_message_unref(reply);
return FALSE;
+ }
id = device_get_ieee1284_id(adapter, object_path);
- if (id == NULL)
+ if (id == NULL) {
+ dbus_message_unref(reply);
return FALSE;
+ }
printf("%s", id);
g_free(id);
+ dbus_message_unref(reply);
+
return TRUE;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/4] agent: Fix D-Bus reply memory leaks
2011-12-06 14:59 [PATCH 1/4] telephony-maemo5: Fix D-Bus reply memory leaks Syam Sidhardhan
2011-12-06 14:59 ` [PATCH 2/4] cups: " Syam Sidhardhan
@ 2011-12-06 14:59 ` Syam Sidhardhan
2011-12-06 14:59 ` [PATCH 4/4] mpris-player: " Syam Sidhardhan
2011-12-08 10:45 ` [PATCH 1/4] telephony-maemo5: " Johan Hedberg
3 siblings, 0 replies; 5+ messages in thread
From: Syam Sidhardhan @ 2011-12-06 14:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Syam Sidhardhan
---
test/agent.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/test/agent.c b/test/agent.c
index ae74074..5cdeeb4 100644
--- a/test/agent.c
+++ b/test/agent.c
@@ -504,6 +504,7 @@ static char *get_default_adapter_path(DBusConnection *conn)
fprintf(stderr, "%s\n", err.message);
dbus_error_free(&err);
}
+ dbus_message_unref(reply);
return NULL;
}
@@ -562,6 +563,7 @@ static char *get_adapter_path(DBusConnection *conn, const char *adapter)
fprintf(stderr, "%s\n", err.message);
dbus_error_free(&err);
}
+ dbus_message_unref(reply);
return NULL;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] mpris-player: Fix D-Bus reply memory leaks
2011-12-06 14:59 [PATCH 1/4] telephony-maemo5: Fix D-Bus reply memory leaks Syam Sidhardhan
2011-12-06 14:59 ` [PATCH 2/4] cups: " Syam Sidhardhan
2011-12-06 14:59 ` [PATCH 3/4] agent: " Syam Sidhardhan
@ 2011-12-06 14:59 ` Syam Sidhardhan
2011-12-08 10:45 ` [PATCH 1/4] telephony-maemo5: " Johan Hedberg
3 siblings, 0 replies; 5+ messages in thread
From: Syam Sidhardhan @ 2011-12-06 14:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Syam Sidhardhan
---
test/mpris-player.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/test/mpris-player.c b/test/mpris-player.c
index a1632f3..a2c4cc6 100644
--- a/test/mpris-player.c
+++ b/test/mpris-player.c
@@ -700,6 +700,7 @@ static char *get_default_adapter(DBusConnection *conn)
fprintf(stderr, "%s\n", err.message);
dbus_error_free(&err);
}
+ dbus_message_unref(reply);
return NULL;
}
@@ -756,6 +757,7 @@ static char *get_adapter(DBusConnection *conn, const char *adapter)
fprintf(stderr, "%s\n", err.message);
dbus_error_free(&err);
}
+ dbus_message_unref(reply);
return NULL;
}
@@ -802,8 +804,10 @@ static char *get_name_owner(DBusConnection *conn, const char *name)
if (!dbus_message_get_args(reply, NULL,
DBUS_TYPE_STRING, &owner,
- DBUS_TYPE_INVALID))
+ DBUS_TYPE_INVALID)) {
+ dbus_message_unref(reply);
return NULL;
+ }
owner = g_strdup(owner);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread