From: Markus Elfring Date: Sat, 14 Jan 2017 16:43:47 +0000 (+0100) Subject: selinux: One function call less in genfs_read() after null pointer detection X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=315e01ada8047cba0520ecca050ad8f5237abb41;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git selinux: One function call less in genfs_read() after null pointer detection Call the function "kfree" at the end only after it was determined that the local variable "newgenfs" contained a non-null pointer. Signed-off-by: Markus Elfring Signed-off-by: Paul Moore --- diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index 375e304070e1..4390558464c5 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -2098,9 +2098,10 @@ static int genfs_read(struct policydb *p, void *fp) } rc = 0; out: - if (newgenfs) + if (newgenfs) { kfree(newgenfs->fstype); - kfree(newgenfs); + kfree(newgenfs); + } ocontext_destroy(newc, OCON_FSUSE); return rc;