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>
diff --git a/tools/proftool.c b/tools/proftool.c
index af2cdb6..c7b427f 100644
--- a/tools/proftool.c
+++ b/tools/proftool.c
@@ -676,6 +676,7 @@
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 @@
} else {
error("Unknown command in trace config data line %d\n",
linenum);
+ free(line);
return -1;
}
@@ -692,6 +694,7 @@
if (!tok) {
error("Missing pattern in trace config data line %d\n",
linenum);
+ free(line);
return -1;
}