Skip to content

Commit

Permalink
[PATCH] selinux: fix memory leak
Browse files Browse the repository at this point in the history
This patch fixes a memory leak when a policydb structure is destroyed.

Signed-off-by: Darrel Goeddel <dgoeddel@trustedcs.com>
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Darrel Goeddel authored and Linus Torvalds committed Jul 31, 2006
1 parent d1bbf14 commit ddccef3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions security/selinux/ss/policydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,18 @@ void policydb_destroy(struct policydb *p)
kfree(lra);

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;
}
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) {
for (i = 0; i < p->p_types.nprim; i++)
Expand Down

0 comments on commit ddccef3

Please sign in to comment.