未验证 提交 3c82dc4a 编写于 作者: O openharmony_ci 提交者: Gitee

!1047 Fix use after free in dlclose

Merge pull request !1047 from guzhihao4/fix_dlclose_free2
......@@ -3868,14 +3868,6 @@ static int dlclose_impl(struct dso *p, struct dso **dso_close_list, int *dso_clo
dso_close_list[*dso_close_list_size] = p;
*dso_close_list_size += 1;
if (p->parents) {
free(p->parents);
}
free_reloc_can_search_dso(p);
if (p->tls.size == 0) {
free(p);
}
trace_marker_end(HITRACE_TAG_MUSL);
return 0;
......@@ -3924,6 +3916,15 @@ static int do_dlclose(struct dso *p)
for (size_t i = 0; i < dso_close_list_size; i++) {
unmap_library(dso_close_list[i]);
if (dso_close_list[i]->parents) {
free(dso_close_list[i]->parents);
}
free_reloc_can_search_dso(dso_close_list[i]);
if (dso_close_list[i]->tls.size == 0) {
free(dso_close_list[i]);
}
}
free(dso_close_list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册