Commit 4f1a6ef1 authored by Linus Torvalds's avatar Linus Torvalds

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()
parents dcb8cfbd 45385237
...@@ -272,6 +272,8 @@ static int rangetr_cmp(struct hashtab *h, const void *k1, const void *k2) ...@@ -272,6 +272,8 @@ static int rangetr_cmp(struct hashtab *h, const void *k1, const void *k2)
return v; return v;
} }
static int (*destroy_f[SYM_NUM]) (void *key, void *datum, void *datap);
/* /*
* Initialize a policy database structure. * Initialize a policy database structure.
*/ */
...@@ -319,8 +321,10 @@ static int policydb_init(struct policydb *p) ...@@ -319,8 +321,10 @@ static int policydb_init(struct policydb *p)
out: out:
hashtab_destroy(p->filename_trans); hashtab_destroy(p->filename_trans);
hashtab_destroy(p->range_tr); 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); hashtab_destroy(p->symtab[i].table);
}
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment