diff options
| author | Mark Brown <broonie@kernel.org> | 2025-07-07 23:02:59 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-07-07 23:02:59 +0300 |
| commit | bb96a315b4d84904edd2dae17910f10022ab71d5 (patch) | |
| tree | e858237bd1335da828da7611979931fe890e33e6 /tools/lib | |
| parent | 12826a49f029cd7ed794b1973ee31922f0e08e6f (diff) | |
| parent | 08dc0f5cc26a203e8008c38d9b436c079e7dbb45 (diff) | |
| download | linux-bb96a315b4d84904edd2dae17910f10022ab71d5.tar.xz | |
ASoC: soc-dapm: cleanups
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
This is prepare to hiding snd_soc_dapm_context inside soc-dapm.c
Diffstat (limited to 'tools/lib')
| -rw-r--r-- | tools/lib/bpf/btf_dump.c | 3 | ||||
| -rw-r--r-- | tools/lib/bpf/libbpf.c | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c index 460c3e57fadb..0381f209920a 100644 --- a/tools/lib/bpf/btf_dump.c +++ b/tools/lib/bpf/btf_dump.c @@ -226,6 +226,9 @@ static void btf_dump_free_names(struct hashmap *map) size_t bkt; struct hashmap_entry *cur; + if (!map) + return; + hashmap__for_each_entry(map, cur, bkt) free((void *)cur->pkey); diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index e9c641a2fb20..52e353368f58 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -597,7 +597,7 @@ struct extern_desc { int sym_idx; int btf_id; int sec_btf_id; - const char *name; + char *name; char *essent_name; bool is_set; bool is_weak; @@ -4259,7 +4259,9 @@ static int bpf_object__collect_externs(struct bpf_object *obj) return ext->btf_id; } t = btf__type_by_id(obj->btf, ext->btf_id); - ext->name = btf__name_by_offset(obj->btf, t->name_off); + ext->name = strdup(btf__name_by_offset(obj->btf, t->name_off)); + if (!ext->name) + return -ENOMEM; ext->sym_idx = i; ext->is_weak = ELF64_ST_BIND(sym->st_info) == STB_WEAK; @@ -9138,8 +9140,10 @@ void bpf_object__close(struct bpf_object *obj) zfree(&obj->btf_custom_path); zfree(&obj->kconfig); - for (i = 0; i < obj->nr_extern; i++) + for (i = 0; i < obj->nr_extern; i++) { + zfree(&obj->externs[i].name); zfree(&obj->externs[i].essent_name); + } zfree(&obj->externs); obj->nr_extern = 0; |
