Skip to content

Commit

Permalink
apparmor: Remove unnecessary NULL check before kvfree()
Browse files Browse the repository at this point in the history
Since kvfree() already checks if its argument is NULL, an additional
check before calling kvfree() is unnecessary and can be removed.

Remove it and the following Coccinelle/coccicheck warning reported by
ifnullfree.cocci:

  WARNING: NULL check before some freeing functions is not needed

Signed-off-by: Thorsten Blum <[email protected]>
Signed-off-by: John Johansen <[email protected]>
  • Loading branch information
toblux authored and John Johansen committed Nov 27, 2024
1 parent ab6875f commit 648e45d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions security/apparmor/policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ static void aa_free_pdb(struct aa_policydb *pdb)
{
if (pdb) {
aa_put_dfa(pdb->dfa);
if (pdb->perms)
kvfree(pdb->perms);
kvfree(pdb->perms);
aa_free_str_table(&pdb->trans);
kfree(pdb);
}
Expand Down

0 comments on commit 648e45d

Please sign in to comment.