diff options
author | wzt.wzt@gmail.com <wzt.wzt@gmail.com> | 2010-11-10 04:31:55 +0100 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-11-10 21:36:18 +0100 |
commit | 246c3fb16b08193837a8009ff15ef6908534ba71 (patch) | |
tree | 47c8fb1d63c3f0cfd7c3e1507e6c1e16a6837264 /security | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6 (diff) | |
download | linux-246c3fb16b08193837a8009ff15ef6908534ba71.tar.xz linux-246c3fb16b08193837a8009ff15ef6908534ba71.zip |
APPARMOR: Fix memory leak of alloc_namespace()
policy->name is a substring of policy->hname, if prefix is not NULL, it will
allocted strlen(prefix) + strlen(name) + 3 bytes to policy->hname in policy_init().
use kzfree(ns->base.name) will casue memory leak if alloc_namespace() failed.
Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security')
-rw-r--r-- | security/apparmor/policy.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c index 52cc865f1464..4f0eadee78b8 100644 --- a/security/apparmor/policy.c +++ b/security/apparmor/policy.c @@ -306,7 +306,7 @@ static struct aa_namespace *alloc_namespace(const char *prefix, return ns; fail_unconfined: - kzfree(ns->base.name); + kzfree(ns->base.hname); fail_ns: kzfree(ns); return NULL; |