From: Linus Torvalds Date: Sat, 3 Aug 2019 01:40:49 +0000 (-0700) Subject: Merge tag 'selinux-pr-20190801' of git://git.kernel.org/pub/scm/linux/kernel/git... X-Git-Tag: v5.15~5776 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f1a6ef1df6f952fc9f22f34d51a6c3d3c4fbe23;hp=-c;p=platform%2Fkernel%2Flinux-starfive.git Merge tag 'selinux-pr-20190801' of git://git./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() --- 4f1a6ef1df6f952fc9f22f34d51a6c3d3c4fbe23 diff --combined security/selinux/ss/policydb.c index 624ccc6,38d0083..f8efaa9 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@@ -1,4 -1,3 +1,4 @@@ +// SPDX-License-Identifier: GPL-2.0-only /* * Implementation of the policy database. * @@@ -26,6 -25,9 +26,6 @@@ * Copyright (C) 2007 Hewlett-Packard Development Company, L.P. * Copyright (C) 2004-2005 Trusted Computer Solutions, Inc. * Copyright (C) 2003 - 2004 Tresys Technology, LLC - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 2. */ #include @@@ -272,6 -274,8 +272,8 @@@ static int rangetr_cmp(struct hashtab * return v; } + static int (*destroy_f[SYM_NUM]) (void *key, void *datum, void *datap); + /* * Initialize a policy database structure. */ @@@ -319,8 -323,10 +321,10 @@@ static int policydb_init(struct policyd 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; }