summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-08-03 04:40:49 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2019-08-03 04:40:49 +0300
commit4f1a6ef1df6f952fc9f22f34d51a6c3d3c4fbe23 (patch)
tree4cb37f8bcb04d72699a044bba11fb1233cda74d3 /security
parentdcb8cfbd8fe9e62c7d64e82288d3ffe2502b7371 (diff)
parent45385237f65aeee73641f1ef737d7273905a233f (diff)
downloadlinux-4f1a6ef1df6f952fc9f22f34d51a6c3d3c4fbe23.tar.xz
Merge tag 'selinux-pr-20190801' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux fix from Paul Moore: "One more small fix for a potential memory leak in an error path" * tag 'selinux-pr-20190801' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: selinux: fix memory leak in policydb_init()
Diffstat (limited to 'security')
-rw-r--r--security/selinux/ss/policydb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 624ccc6ac744..f8efaa9f647c 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -272,6 +272,8 @@ static int rangetr_cmp(struct hashtab *h, const void *k1, const void *k2)
return v;
}
+static int (*destroy_f[SYM_NUM]) (void *key, void *datum, void *datap);
+
/*
* Initialize a policy database structure.
*/
@@ -319,8 +321,10 @@ static int policydb_init(struct policydb *p)
out:
hashtab_destroy(p->filename_trans);
hashtab_destroy(p->range_tr);
- for (i = 0; i < SYM_NUM; i++)
+ for (i = 0; i < SYM_NUM; i++) {
+ hashtab_map(p->symtab[i].table, destroy_f[i], NULL);
hashtab_destroy(p->symtab[i].table);
+ }
return rc;
}