aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/policydb.c
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-01-14 17:43:47 +0100
committerPaul Moore <paul@paul-moore.com>2017-03-23 17:53:29 -0400
commit315e01ada8047cba0520ecca050ad8f5237abb41 (patch)
tree1f6c9da320e1f8ac8582b8dfc0d430a70f53e83c /security/selinux/ss/policydb.c
parentselinux: Return directly after a failed next_entry() in genfs_read() (diff)
downloadlinux-dev-315e01ada8047cba0520ecca050ad8f5237abb41.tar.xz
linux-dev-315e01ada8047cba0520ecca050ad8f5237abb41.zip
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 <elfring@users.sourceforge.net> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/ss/policydb.c')
-rw-r--r--security/selinux/ss/policydb.c5
1 files changed, 3 insertions, 2 deletions
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;