selinux: One function call less in genfs_read() after null pointer detection
authorMarkus Elfring <elfring@users.sourceforge.net>
Sat, 14 Jan 2017 16:43:47 +0000 (17:43 +0100)
committerPaul Moore <paul@paul-moore.com>
Thu, 23 Mar 2017 21:53:29 +0000 (17:53 -0400)
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>
security/selinux/ss/policydb.c

index 375e304070e1597d97ac2680d24e56741da30402..4390558464c553196059e35d243022b3b381fa62 100644 (file)
@@ -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;