Diff between 18d9ccbc91e437c795b71284591874635f52d9ec and 19206e7bb0de88e00fa4d17db951ace3d4e84fac

Changed Files

File Additions Deletions Status
tools/cltest.c +3 -2 modified

Full Patch

diff --git a/tools/cltest.c b/tools/cltest.c
index 16b7553..4ddb98a 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;
 }