summaryrefslogtreecommitdiffstats
path: root/daemon/echo.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-28 18:24:03 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-28 18:24:03 +0000
commite27f44b9a6b6fc16f8376f8d59b54ea57231888e (patch)
treeae2dce7be17349a98f2e75c4da0034633e218520 /daemon/echo.c
parent6a5605954320fe1d43fa6957e07ec4bcc9724454 (diff)
Fix some memory leaks
Diffstat (limited to 'daemon/echo.c')
-rw-r--r--daemon/echo.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/daemon/echo.c b/daemon/echo.c
index 16acf5a5..042d9820 100644
--- a/daemon/echo.c
+++ b/daemon/echo.c
@@ -187,6 +187,7 @@ static int setup_sdp(DBusConnection *conn, uint8_t channel)
uuid_t root_uuid, l2cap, rfcomm, spp;
sdp_profile_desc_t profile[1];
sdp_list_t *proto[2];
+ sdp_data_t *chan;
record = sdp_record_alloc();
if (!record) {
@@ -202,9 +203,10 @@ static int setup_sdp(DBusConnection *conn, uint8_t channel)
proto[0] = sdp_list_append(NULL, &l2cap);
apseq = sdp_list_append(NULL, proto[0]);
+ chan = sdp_data_alloc(SDP_UINT8, &channel);
sdp_uuid16_create(&rfcomm, RFCOMM_UUID);
proto[1] = sdp_list_append(NULL, &rfcomm);
- proto[1] = sdp_list_append(proto[1], sdp_data_alloc(SDP_UINT8, &channel));
+ proto[1] = sdp_list_append(proto[1], chan);
apseq = sdp_list_append(apseq, proto[1]);
aproto = sdp_list_append(NULL, apseq);
@@ -227,6 +229,17 @@ static int setup_sdp(DBusConnection *conn, uint8_t channel)
return -1;
}
+ sdp_data_free(chan);
+ sdp_list_free(root, NULL);
+ sdp_list_free(apseq, NULL);
+ sdp_list_free(pfseq, NULL);
+ sdp_list_free(aproto, NULL);
+ sdp_list_free(svclass, NULL);
+ sdp_list_free(proto[0], NULL);
+ sdp_list_free(proto[1], NULL);
+
+ sdp_record_free(record);
+
msg = dbus_message_new_method_call("org.bluez", "/org/bluez",
"org.bluez.Database", "AddServiceRecord");
if (!msg) {
@@ -239,6 +252,8 @@ static int setup_sdp(DBusConnection *conn, uint8_t channel)
reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, NULL);
+ dbus_message_unref(msg);
+
free(buf.data);
if (!reply) {
@@ -272,6 +287,9 @@ static int register_standalone(DBusConnection *conn)
DBUS_TYPE_STRING, &desc, DBUS_TYPE_INVALID);
reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, NULL);
+
+ dbus_message_unref(msg);
+
if (!reply) {
error("Registration of service failed");
return -1;