From 4e18b47c73cdffb1dbd9ea196aeaff20e5030ade Mon Sep 17 00:00:00 2001 From: Maks Mishin Date: Wed, 5 Feb 2025 19:26:07 +0300 Subject: [PATCH] tools: proftool: Fix potential memory leaks Dynamic memory, referenced by 'line', is allocated by calling function 'calloc' and lost when the function terminates with code -1. Signed-off-by: Maks Mishin --- tools/proftool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/proftool.c b/tools/proftool.c index af2cdb6d584..c7b427f3078 100644 --- a/tools/proftool.c +++ b/tools/proftool.c @@ -676,6 +676,7 @@ static int read_trace_config(FILE *fin) if (!tok) { error("Invalid trace config data on line %d\n", linenum); + free(line); return -1; } if (0 == strcmp(tok, "include-func")) { @@ -685,6 +686,7 @@ static int read_trace_config(FILE *fin) } else { error("Unknown command in trace config data line %d\n", linenum); + free(line); return -1; } @@ -692,6 +694,7 @@ static int read_trace_config(FILE *fin) if (!tok) { error("Missing pattern in trace config data line %d\n", linenum); + free(line); return -1; } -- 2.39.5