[PATCH 1/5] hcitool: Fix memory leak in cmd_info

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

 



Free memory pointed by cr variable after it is used.
---
 tools/hcitool.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/hcitool.c b/tools/hcitool.c
index 8a92067..c2df8e3 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -961,6 +961,7 @@ static void cmd_info(int dev_id, int argc, char **argv)
 					htobs(di.pkt_type & ACL_PTYPE_MASK),
 					0, 0x01, &handle, 25000) < 0) {
 			perror("Can't create connection");
+			free(cr);
 			close(dd);
 			exit(1);
 		}
@@ -969,6 +970,8 @@ static void cmd_info(int dev_id, int argc, char **argv)
 	} else
 		handle = htobs(cr->conn_info->handle);
 
+	free(cr);
+
 	printf("\tBD Address:  %s\n", argv[0]);
 
 	comp = batocomp(&bdaddr);
-- 
1.8.5.3

--
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