diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-09-03 20:57:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-09-03 20:57:55 -0400 |
commit | d210baf53b699fc61aa891c177b71d7082d3b957 (patch) | |
tree | 5fafeb7e9198927f15006d93af734f754880adc0 | |
parent | 3e25a2d90e7e303168540c5ecb726297940cb172 (diff) | |
parent | 8e531af90f3940615623dc0aa6c94866a6773601 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
SELinux: memory leak in security_context_to_sid_core
-rw-r--r-- | security/selinux/ss/services.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index b52f923ce680..d11a8154500f 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -811,11 +811,12 @@ static int string_to_context_struct(struct policydb *pol, | |||
811 | /* Check the validity of the new context. */ | 811 | /* Check the validity of the new context. */ |
812 | if (!policydb_context_isvalid(pol, ctx)) { | 812 | if (!policydb_context_isvalid(pol, ctx)) { |
813 | rc = -EINVAL; | 813 | rc = -EINVAL; |
814 | context_destroy(ctx); | ||
815 | goto out; | 814 | goto out; |
816 | } | 815 | } |
817 | rc = 0; | 816 | rc = 0; |
818 | out: | 817 | out: |
818 | if (rc) | ||
819 | context_destroy(ctx); | ||
819 | return rc; | 820 | return rc; |
820 | } | 821 | } |
821 | 822 | ||
@@ -868,8 +869,7 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len, | |||
868 | } else if (rc) | 869 | } else if (rc) |
869 | goto out; | 870 | goto out; |
870 | rc = sidtab_context_to_sid(&sidtab, &context, sid); | 871 | rc = sidtab_context_to_sid(&sidtab, &context, sid); |
871 | if (rc) | 872 | context_destroy(&context); |
872 | context_destroy(&context); | ||
873 | out: | 873 | out: |
874 | read_unlock(&policy_rwlock); | 874 | read_unlock(&policy_rwlock); |
875 | kfree(scontext2); | 875 | kfree(scontext2); |