Commit ddccef3b authored by Darrel Goeddel's avatar Darrel Goeddel Committed by Linus Torvalds

[PATCH] selinux: fix memory leak

This patch fixes a memory leak when a policydb structure is destroyed.
Signed-off-by: default avatarDarrel Goeddel <dgoeddel@trustedcs.com>
Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
Acked-by: default avatarJames Morris <jmorris@namei.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment