diff options
author | Ian Rogers <[email protected]> | 2023-10-09 11:39:15 -0700 |
---|---|---|
committer | Namhyung Kim <[email protected]> | 2023-10-12 10:01:57 -0700 |
commit | 1370406d35b45457aae295a6cfce9fae2bbd785e (patch) | |
tree | e12948eeb5df492a42ab8363c08a2d22782467b6 | |
parent | 63d471979e49148e59eae0b33a57c12d535e20c6 (diff) |
perf lock: Fix a memory leak on an error path
If a memory allocation fails then the strdup-ed string needs
freeing. Detected by clang-tidy.
Signed-off-by: Ian Rogers <[email protected]>
Acked-by: Namhyung Kim <[email protected]>
Cc: Ravi Bangoria <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: Yang Jihong <[email protected]>
Cc: Huacai Chen <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: [email protected]
Cc: Ming Wang <[email protected]>
Cc: Tom Rix <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Namhyung Kim <[email protected]>
-rw-r--r-- | tools/perf/builtin-lock.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index fa7419978353..a3ff2f4edbaa 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -2478,6 +2478,7 @@ static int parse_call_stack(const struct option *opt __maybe_unused, const char entry = malloc(sizeof(*entry) + strlen(tok) + 1); if (entry == NULL) { pr_err("Memory allocation failure\n"); + free(s); return -1; } |