From 28faab63be1eb83bf26f394552f46bce1b1d4114 Mon Sep 17 00:00:00 2001 From: "Gustavo F. Padovan" Date: Mon, 9 Feb 2009 21:50:56 -0200 Subject: Fix memory leaks in hciconfig and hcitool Some printfs were using functions that return dynamic allocated memory as parameters. --- tools/hciconfig.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'tools/hciconfig.c') diff --git a/tools/hciconfig.c b/tools/hciconfig.c index 960f450b..a89aed13 100644 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -85,7 +85,10 @@ static void print_dev_list(int ctl, int flags) static void print_pkt_type(struct hci_dev_info *di) { - printf("\tPacket type: %s\n", hci_ptypetostr(di->pkt_type)); + char *str; + str = hci_ptypetostr(di->pkt_type); + printf("\tPacket type: %s\n", str); + bt_free(str); } static void print_link_policy(struct hci_dev_info *di) @@ -95,7 +98,10 @@ static void print_link_policy(struct hci_dev_info *di) static void print_link_mode(struct hci_dev_info *di) { - printf("\tLink mode: %s\n", hci_lmtostr(di->link_mode)); + char *str; + str = hci_lmtostr(di->link_mode); + printf("\tLink mode: %s\n", str); + bt_free(str); } static void print_dev_features(struct hci_dev_info *di, int format) @@ -1586,10 +1592,13 @@ static void print_dev_hdr(struct hci_dev_info *di) static void print_dev_info(int ctl, struct hci_dev_info *di) { struct hci_dev_stats *st = &di->stat; + char *str; print_dev_hdr(di); - printf("\t%s\n", hci_dflagstostr(di->flags) ); + str = hci_dflagstostr(di->flags); + printf("\t%s\n", str); + bt_free(str); printf("\tRX bytes:%d acl:%d sco:%d events:%d errors:%d\n", st->byte_rx, st->acl_rx, st->sco_rx, st->evt_rx, st->err_rx); -- cgit