* [PATCH] selinux: fix memory leak
@ 2006-07-13 15:33 Darrel Goeddel
2006-07-14 5:03 ` James Morris
0 siblings, 1 reply; 2+ messages in thread
From: Darrel Goeddel @ 2006-07-13 15:33 UTC (permalink / raw)
To: selinux@tycho.nsa.gov; +Cc: Stephen Smalley, James Morris
This patch fixes a possible memory leak when a policydb structure
is destroyed.
Signed-off-by: Darrel Goeddel <dgoeddel@trustedcs.com>
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 0111990..f03960e 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++)
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] selinux: fix memory leak
2006-07-13 15:33 [PATCH] selinux: fix memory leak Darrel Goeddel
@ 2006-07-14 5:03 ` James Morris
0 siblings, 0 replies; 2+ messages in thread
From: James Morris @ 2006-07-14 5:03 UTC (permalink / raw)
To: Darrel Goeddel; +Cc: selinux@tycho.nsa.gov, Stephen Smalley
On Thu, 13 Jul 2006, Darrel Goeddel wrote:
> This patch fixes a possible memory leak when a policydb structure
> is destroyed.
>
> Signed-off-by: Darrel Goeddel <dgoeddel@trustedcs.com>
Acked-by: James Morris <jmorris@namei.org>
>
> diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
> index 0111990..f03960e 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++)
>
--
James Morris
<jmorris@namei.org>
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-07-14 5:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-13 15:33 [PATCH] selinux: fix memory leak Darrel Goeddel
2006-07-14 5:03 ` James Morris
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.