提交 ddccef3b 编写于 作者: D Darrel Goeddel 提交者: Linus Torvalds

[PATCH] selinux: fix memory leak

This patch fixes a memory leak when a policydb structure is destroyed.
Signed-off-by: NDarrel Goeddel <dgoeddel@trustedcs.com>
Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
Acked-by: NJames Morris <jmorris@namei.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 d1bbf14f
...@@ -644,10 +644,18 @@ void policydb_destroy(struct policydb *p) ...@@ -644,10 +644,18 @@ void policydb_destroy(struct policydb *p)
kfree(lra); kfree(lra);
for (rt = p->range_tr; rt; rt = rt -> next) { for (rt = p->range_tr; rt; rt = rt -> next) {
kfree(lrt); if (lrt) {
ebitmap_destroy(&lrt->range.level[0].cat);
ebitmap_destroy(&lrt->range.level[1].cat);
kfree(lrt);
}
lrt = rt; lrt = rt;
} }
kfree(lrt); if (lrt) {
ebitmap_destroy(&lrt->range.level[0].cat);
ebitmap_destroy(&lrt->range.level[1].cat);
kfree(lrt);
}
if (p->type_attr_map) { if (p->type_attr_map) {
for (i = 0; i < p->p_types.nprim; i++) for (i = 0; i < p->p_types.nprim; i++)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册