Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jmorris/security-testing-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
  APPARMOR: Fix memory leak of apparmor_init()
  APPARMOR: Fix memory leak of alloc_namespace()
  • Loading branch information
torvalds committed Nov 12, 2010
2 parents 0f90933 + a26d279 commit fe7e96f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions security/apparmor/lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ static int __init apparmor_init(void)
error = register_security(&apparmor_ops);
if (error) {
AA_ERROR("Unable to register AppArmor\n");
goto register_security_out;
goto set_init_cxt_out;
}

/* Report that AppArmor successfully initialized */
Expand All @@ -936,6 +936,9 @@ static int __init apparmor_init(void)

return error;

set_init_cxt_out:
aa_free_task_context(current->real_cred->security);

register_security_out:
aa_free_root_ns();

Expand All @@ -944,7 +947,6 @@ static int __init apparmor_init(void)

apparmor_enabled = 0;
return error;

}

security_initcall(apparmor_init);
2 changes: 1 addition & 1 deletion security/apparmor/policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fe7e96f

Please sign in to comment.