summaryrefslogtreecommitdiff
path: root/tools/proftool.c
diff options
context:
space:
mode:
authorMaks Mishin <maks.mishinfz@gmail.com>2025-02-05 19:26:07 +0300
committerTom Rini <trini@konsulko.com>2025-02-11 08:17:23 -0600
commit4e18b47c73cdffb1dbd9ea196aeaff20e5030ade (patch)
tree4bc770514af56781797f678131fb21fc733b3e97 /tools/proftool.c
parent4545880c3c86ff48fc88073f390ccab9cff7c11b (diff)
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>
Diffstat (limited to 'tools/proftool.c')
-rw-r--r--tools/proftool.c3
1 files changed, 3 insertions, 0 deletions
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;
}