diff options
author | 2006-07-30 03:03:17 -0700 | |
---|---|---|
committer | 2006-07-31 13:28:37 -0700 | |
commit | ddccef3b5ec906ff181171e8ffad4fcb996792fd (patch) | |
tree | fd65ff65baf451983c862b4a3a8c08e925ca5629 | |
parent | [PATCH] knfsd: Fix stale file handle problem with subtree_checking. (diff) | |
download | linux-ddccef3b5ec906ff181171e8ffad4fcb996792fd.tar.gz linux-ddccef3b5ec906ff181171e8ffad4fcb996792fd.tar.bz2 linux-ddccef3b5ec906ff181171e8ffad4fcb996792fd.zip |
[PATCH] selinux: fix memory leak
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>
-rw-r--r-- | security/selinux/ss/policydb.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 0111990ba837..f03960e697ce 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -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++) |