From 19206e7bb0de88e00fa4d17db951ace3d4e84fac Mon Sep 17 00:00:00 2001 From: Andre Guedes Date: Fri, 7 Feb 2014 19:28:43 -0300 Subject: [PATCH] cltest: Fix memory leak --- tools/cltest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/cltest.c b/tools/cltest.c index 16b7553bc..4ddb98a5b 100644 --- a/tools/cltest.c +++ b/tools/cltest.c @@ -205,8 +205,8 @@ static bool find_controllers(void) dl = malloc(HCI_MAX_DEV * sizeof(struct hci_dev_req) + sizeof(uint16_t)); if (!dl) { perror("Failed allocate HCI device request memory"); - result = false; - goto done; + close(fd); + return false; } dl->dev_num = HCI_MAX_DEV; @@ -243,6 +243,7 @@ static bool find_controllers(void) } done: + free(dl); close(fd); return result; } -- 2.47.3