[PATCH 1/6] Fix more memory leaks in hcitool

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

 



Free some mallocs.
---
 tools/hcitool.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/tools/hcitool.c b/tools/hcitool.c
index faf4cb4..3ba9234 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -110,6 +110,7 @@ static int conn_list(int s, int dev_id, long arg)
 			addr, ci->handle, ci->state, str);
 		bt_free(str);
 	}
+	bt_free(cl);
 
 	return 0;
 }
@@ -134,9 +135,12 @@ static int find_conn(int s, int dev_id, long arg)
 	}
 
 	for (i = 0; i < cl->conn_num; i++, ci++)
-		if (!bacmp((bdaddr_t *) arg, &ci->bdaddr))
+		if (!bacmp((bdaddr_t *) arg, &ci->bdaddr)) {
+			bt_free(cl);
 			return 1;
+		}
 
+	bt_free(cl);
 	return 0;
 }
 
@@ -894,6 +898,7 @@ static void cmd_info(int dev_id, int argc, char **argv)
 		cc = 1;
 	} else
 		handle = htobs(cr->conn_info->handle);
+	bt_free(cr);
 
 	printf("\tBD Address:  %s\n", argv[0]);
 
-- 
1.6.0.6

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