diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-08-02 18:40:49 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-08-02 18:40:49 -0700 |
commit | 4f1a6ef1df6f952fc9f22f34d51a6c3d3c4fbe23 (patch) | |
tree | 4cb37f8bcb04d72699a044bba11fb1233cda74d3 /security | |
parent | dcb8cfbd8fe9e62c7d64e82288d3ffe2502b7371 (diff) | |
parent | 45385237f65aeee73641f1ef737d7273905a233f (diff) | |
download | linux-stable-4f1a6ef1df6f952fc9f22f34d51a6c3d3c4fbe23.tar.gz linux-stable-4f1a6ef1df6f952fc9f22f34d51a6c3d3c4fbe23.tar.bz2 linux-stable-4f1a6ef1df6f952fc9f22f34d51a6c3d3c4fbe23.zip |
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.c | 6 |
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; } |