diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-09-04 00:57:55 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-09-04 00:57:55 (GMT) |
commit | d210baf53b699fc61aa891c177b71d7082d3b957 (patch) | |
tree | 5fafeb7e9198927f15006d93af734f754880adc0 | |
parent | 3e25a2d90e7e303168540c5ecb726297940cb172 (diff) | |
parent | 8e531af90f3940615623dc0aa6c94866a6773601 (diff) | |
download | linux-d210baf53b699fc61aa891c177b71d7082d3b957.tar.xz |
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 b52f923..d11a815 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, /* Check the validity of the new context. */ if (!policydb_context_isvalid(pol, ctx)) { rc = -EINVAL; - context_destroy(ctx); goto out; } rc = 0; out: + if (rc) + context_destroy(ctx); return rc; } @@ -868,8 +869,7 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len, } else if (rc) goto out; rc = sidtab_context_to_sid(&sidtab, &context, sid); - if (rc) - context_destroy(&context); + context_destroy(&context); out: read_unlock(&policy_rwlock); kfree(scontext2); |