From ab325450b0c2b3e9a1b13d81e079d0bcd34e1835 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 10 May 2024 14:10:16 +0200 Subject: [PATCH] client/main: Fix mismatched free Error: ALLOC_FREE_MISMATCH (CWE-762): [#def37] client/main.c:2108:2: alloc: Allocation of memory which must be freed using "g_free". client/main.c:2108:2: assign: Assigning: "desc" = "g_strdup_printf("\x1b[0;94m[%s]\x1b[0m# ", attr)". 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 495dc98bb..f012ddd43 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.47.3