mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2026-01-27 20:49:52 +00:00
perf bpf_counter: Fix a few memory leaks
Memory leaks were detected by clang-tidy. Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung 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-20-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
1052545017
commit
b84b3f4792
@ -104,7 +104,7 @@ static int bpf_program_profiler_load_one(struct evsel *evsel, u32 prog_id)
|
||||
struct bpf_prog_profiler_bpf *skel;
|
||||
struct bpf_counter *counter;
|
||||
struct bpf_program *prog;
|
||||
char *prog_name;
|
||||
char *prog_name = NULL;
|
||||
int prog_fd;
|
||||
int err;
|
||||
|
||||
@ -155,10 +155,12 @@ static int bpf_program_profiler_load_one(struct evsel *evsel, u32 prog_id)
|
||||
assert(skel != NULL);
|
||||
counter->skel = skel;
|
||||
list_add(&counter->list, &evsel->bpf_counter_list);
|
||||
free(prog_name);
|
||||
close(prog_fd);
|
||||
return 0;
|
||||
err_out:
|
||||
bpf_prog_profiler_bpf__destroy(skel);
|
||||
free(prog_name);
|
||||
free(counter);
|
||||
close(prog_fd);
|
||||
return -1;
|
||||
@ -180,6 +182,7 @@ static int bpf_program_profiler__load(struct evsel *evsel, struct target *target
|
||||
(*p != '\0' && *p != ',')) {
|
||||
pr_err("Failed to parse bpf prog ids %s\n",
|
||||
target->bpf_str);
|
||||
free(bpf_str_);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user