diff options
author | John Johansen <john.johansen@canonical.com> | 2017-11-15 18:25:30 -0500 |
---|---|---|
committer | John Johansen <john.johansen@canonical.com> | 2017-11-21 05:17:13 -0500 |
commit | 4633307e5ed6128975595df43f796a10c41d11c1 (patch) | |
tree | 69a59e0adcd575811ee7b05190111929d89ca173 | |
parent | e3bcfc148588e409685479f3d20ba3d66ae30035 (diff) |
apparmor: fix leak of null profile name if profile allocation fails
Fixes: d07881d2edb0 ("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>
-rw-r--r-- | security/apparmor/policy.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index 4243b0c3f0e4..586b249d3b46 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c | |||
@@ -502,7 +502,7 @@ struct aa_profile *aa_new_null_profile(struct aa_profile *parent, bool hat, | |||
502 | { | 502 | { |
503 | struct aa_profile *p, *profile; | 503 | struct aa_profile *p, *profile; |
504 | const char *bname; | 504 | const char *bname; |
505 | char *name; | 505 | char *name = NULL; |
506 | 506 | ||
507 | AA_BUG(!parent); | 507 | AA_BUG(!parent); |
508 | 508 | ||
@@ -562,6 +562,7 @@ out: | |||
562 | return profile; | 562 | return profile; |
563 | 563 | ||
564 | fail: | 564 | fail: |
565 | kfree(name); | ||
565 | aa_free_profile(profile); | 566 | aa_free_profile(profile); |
566 | return NULL; | 567 | return NULL; |
567 | } | 568 | } |