Skip to content

Commit

Permalink
selinux: One function call less in genfs_read() after null pointer de…
Browse files Browse the repository at this point in the history
…tection

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>
  • Loading branch information
Markus Elfring authored and Paul Moore committed Mar 23, 2017
1 parent 3a0aa56 commit 315e01a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions security/selinux/ss/policydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 315e01a

Please sign in to comment.