Commit 5309b516 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov

selftests/bpf: Free inner strings index in btf selftest

Inner array of allocated strings wasn't freed on success. Now it's
always freed.
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Reviewed-by: default avatarHengqi Chen <hengqi.chen@gmail.com>
Link: https://lore.kernel.org/bpf/20211107165521.9240-6-andrii@kernel.org
parent b8b26e58
...@@ -4046,11 +4046,9 @@ static void *btf_raw_create(const struct btf_header *hdr, ...@@ -4046,11 +4046,9 @@ static void *btf_raw_create(const struct btf_header *hdr,
next_str_idx < strs_cnt ? strs_idx[next_str_idx] : NULL; next_str_idx < strs_cnt ? strs_idx[next_str_idx] : NULL;
done: done:
free(strs_idx);
if (err) { if (err) {
if (raw_btf) free(raw_btf);
free(raw_btf);
if (strs_idx)
free(strs_idx);
return NULL; return NULL;
} }
return raw_btf; return raw_btf;
......
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