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 <maks.mishinFZ@gmail.com>
This commit is contained in:
Maks Mishin 2025-02-05 19:26:07 +03:00 committed by Tom Rini
parent 4545880c3c
commit 4e18b47c73

View File

@ -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;
}