diff options
author | Darrel Goeddel <dgoeddel@TrustedCS.com> | 2006-07-30 03:03:17 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-31 13:28:37 -0700 |
commit | ddccef3b5ec906ff181171e8ffad4fcb996792fd (patch) | |
tree | fd65ff65baf451983c862b4a3a8c08e925ca5629 /security | |
parent | d1bbf14f37261c2c0dba71404602e1ddcec069d2 (diff) | |
download | lwn-ddccef3b5ec906ff181171e8ffad4fcb996792fd.tar.gz lwn-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>
Diffstat (limited to 'security')
-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++) |