apparmor: fix leak of null profile name if profile allocation fails

Fixes: d07881d2ed ("apparmor: move new_null_profile to after profile lookup fns()")
Reported-by: Seth Arnold <seth.arnold@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
John Johansen 2017-11-15 15:25:30 -08:00
parent e3bcfc1485
commit 4633307e5e

View File

@ -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);
@ -562,6 +562,7 @@ out:
return profile;
fail:
kfree(name);
aa_free_profile(profile);
return NULL;
}