From f83abf0cb902c1c7bae714ddd00a92f2ca68f986 Mon Sep 17 00:00:00 2001 From: Ildar Kamaletdinov Date: Sat, 7 May 2022 20:35:02 +0300 Subject: [PATCH] tools: Fix memory leak in hciconfig printf() was using function that return dynamic allocated memory as a parameter. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Signed-off-by: Manika Shrivastava Signed-off-by: Ayush Garg --- tools/hciconfig.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/hciconfig.c b/tools/hciconfig.c index 40a3885..775f7f5 100755 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -85,7 +85,11 @@ static void print_link_policy(struct hci_dev_info *di) printf("\tLink policy: %s\n", str); bt_free(str); #else - printf("\tLink policy: %s\n", hci_lptostr(di->link_policy)); + char *str; + + str = hci_lptostr(di->link_policy); + printf("\tLink policy: %s\n", str); + bt_free(str); #endif } -- 2.7.4