2015-07-27 10:56:26

by Anchit Narang

[permalink] [raw]
Subject: [PATCH v2] tools/hciconfig:Fixed Memory Leak

Freed memory allocated to structure hci_dev_list_req to avoid memory leak
---
tools/hciconfig.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/hciconfig.c b/tools/hciconfig.c
index 6397e71..0e0b790 100644
--- a/tools/hciconfig.c
+++ b/tools/hciconfig.c
@@ -69,6 +69,7 @@ static void print_dev_list(int ctl, int flags)

if (ioctl(ctl, HCIGETDEVLIST, (void *) dl) < 0) {
perror("Can't get device list");
+ free(dl);
exit(1);
}

@@ -78,6 +79,8 @@ static void print_dev_list(int ctl, int flags)
continue;
print_dev_info(ctl, &di);
}
+
+ free(dl);
}

static void print_pkt_type(struct hci_dev_info *di)
--
1.7.9.5



2015-07-29 17:49:03

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH v2] tools/hciconfig:Fixed Memory Leak

Hi Anchit,

On Mon, Jul 27, 2015, Anchit Narang wrote:
> Freed memory allocated to structure hci_dev_list_req to avoid memory leak
> ---
> tools/hciconfig.c | 3 +++
> 1 file changed, 3 insertions(+)

Applied. Thanks.

Johan