[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-bluetooth
Subject: [BlueZ v2 06/20] client/main: Fix mismatched free
From: Bastien Nocera <hadess () hadess ! net>
Date: 2024-05-10 12:10:16
Message-ID: 20240510121355.3241456-7-hadess () hadess ! net
[Download RAW message or body]
Error: ALLOC_FREE_MISMATCH (CWE-762): [#def37]
bluez-5.75/client/main.c:2108:2: alloc: Allocation of memory which must be freed \
using "g_free". bluez-5.75/client/main.c:2108:2: assign: Assigning: "desc" = \
"g_strdup_printf("\x1b[0;94m[%s]\x1b[0m# ", attr)". bluez-5.75/client/main.c:2111:2: \
free: Calling "free" frees "desc" using "free" but it should have been freed using \
"g_free". 2109|
2110| bt_shell_set_prompt(desc);
2111|-> free(desc);
2112| }
2113|
---
client/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/main.c b/client/main.c
index f703cc91b24a..f967c149e7bd 100644
--- a/client/main.c
+++ b/client/main.c
@@ -2113,7 +2113,7 @@ static void set_default_local_attribute(char *attr)
desc = g_strdup_printf(COLOR_BLUE "[%s]" COLOR_OFF "# ", attr);
bt_shell_set_prompt(desc);
- free(desc);
+ g_free(desc);
}
static void cmd_select_attribute(int argc, char *argv[])
--
2.44.0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic