selinux: fix memory leak
PATCH 1/1 selinux: fix memory leak
This patch fixes a possible memory leak when a policydb structure is destroyed.
Signed-off-by Darrel Goeddel <[email protected]>
security/selinux/ss/policydb.c +0 -0
@@ -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 [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 4 lines · Darrel Goeddel
This patch fixes a possible memory leak when a policydb structure is destroyed.
Signed-off-by Darrel Goeddel <[email protected]>
Acked-by James Morris <[email protected]>
Quoted 27 lines
security/selinux/ss/policydb.c +10
-2@@ -644,10 +644,18 @@ void policydb_destroy(struct policydb *pkfree (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++)
Signature · 7 lines
James Morris <[email protected]> -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.