Skip to content

Commit

Permalink
apparmor: fix leak of null profile name if profile allocation fails
Browse files Browse the repository at this point in the history
Fixes: d07881d ("apparmor: move new_null_profile to after profile lookup fns()")
Reported-by: Seth Arnold <[email protected]>
Signed-off-by: John Johansen <[email protected]>
  • Loading branch information
John Johansen committed Nov 21, 2017
1 parent e3bcfc1 commit 4633307
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion security/apparmor/policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ struct aa_profile *aa_new_null_profile(struct aa_profile *parent, bool hat,
{
struct aa_profile *p, *profile;
const char *bname;
char *name;
char *name = NULL;

AA_BUG(!parent);

Expand Down Expand Up @@ -562,6 +562,7 @@ struct aa_profile *aa_new_null_profile(struct aa_profile *parent, bool hat,
return profile;

fail:
kfree(name);
aa_free_profile(profile);
return NULL;
}
Expand Down

0 comments on commit 4633307

Please sign in to comment.