提交 ef1a8bb4 编写于 作者: A Andrii Nakryiko 提交者: Zheng Zengkai

selftests/bpf: Free inner strings index in btf selftest

mainline inclusion
from mainline-5.17-rc1
commit 5309b516
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5EUVD
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5309b516bcc6f76dda0e44a7a1824324277093d6

-------------------------------------------------

Inner array of allocated strings wasn't freed on success. Now it's
always freed.
Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
Reviewed-by: NHengqi Chen <hengqi.chen@gmail.com>
Link: https://lore.kernel.org/bpf/20211107165521.9240-6-andrii@kernel.org
(cherry picked from commit 5309b516)
Signed-off-by: NWang Yufen <wangyufen@huawei.com>
上级 9bbd7b3a
...@@ -3637,11 +3637,9 @@ static void *btf_raw_create(const struct btf_header *hdr, ...@@ -3637,11 +3637,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册