[PATCH BlueZ 06/19] gateway: Fix D-Bus reply memory leak

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

 



Re-arrange the code to avoid the D-Bus memory leak. Earlier if rfcomm
is not connected, then there was a reply memory leak.
---
 audio/gateway.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/audio/gateway.c b/audio/gateway.c
index 19f8ce3..afd2669 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -598,13 +598,13 @@ static DBusMessage *ag_disconnect(DBusConnection *conn, DBusMessage *msg,
 	if (!device->conn)
 		return NULL;
 
+	if (!gw->rfcomm)
+		return  btd_error_not_connected(msg);
+
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
 		return NULL;
 
-	if (!gw->rfcomm)
-		return  btd_error_not_connected(msg);
-
 	gateway_close(device);
 	ba2str(&device->dst, gw_addr);
 	DBG("Disconnected from %s, %s", gw_addr, device->path);
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux