Commit 7875c72c authored by Ian Rogers's avatar Ian Rogers Committed by Namhyung Kim

perf parse-events: Fix unlikely memory leak when cloning terms

Add missing free on an error path as detected by clang-tidy.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: llvm@lists.linux.dev
Cc: Ming Wang <wangming01@loongson.cn>
Cc: Tom Rix <trix@redhat.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20231009183920.200859-16-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 1370406d
...@@ -2549,8 +2549,10 @@ int parse_events_term__clone(struct parse_events_term **new, ...@@ -2549,8 +2549,10 @@ int parse_events_term__clone(struct parse_events_term **new,
return new_term(new, &temp, /*str=*/NULL, term->val.num); return new_term(new, &temp, /*str=*/NULL, term->val.num);
str = strdup(term->val.str); str = strdup(term->val.str);
if (!str) if (!str) {
zfree(&temp.config);
return -ENOMEM; return -ENOMEM;
}
return new_term(new, &temp, str, /*num=*/0); return new_term(new, &temp, str, /*num=*/0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment