Commit d210baf5 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of...

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
parents 3e25a2d9 8e531af9
...@@ -811,11 +811,12 @@ static int string_to_context_struct(struct policydb *pol, ...@@ -811,11 +811,12 @@ static int string_to_context_struct(struct policydb *pol,
/* Check the validity of the new context. */ /* Check the validity of the new context. */
if (!policydb_context_isvalid(pol, ctx)) { if (!policydb_context_isvalid(pol, ctx)) {
rc = -EINVAL; rc = -EINVAL;
context_destroy(ctx);
goto out; goto out;
} }
rc = 0; rc = 0;
out: out:
if (rc)
context_destroy(ctx);
return rc; return rc;
} }
...@@ -868,8 +869,7 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len, ...@@ -868,8 +869,7 @@ static int security_context_to_sid_core(const char *scontext, u32 scontext_len,
} else if (rc) } else if (rc)
goto out; goto out;
rc = sidtab_context_to_sid(&sidtab, &context, sid); rc = sidtab_context_to_sid(&sidtab, &context, sid);
if (rc) context_destroy(&context);
context_destroy(&context);
out: out:
read_unlock(&policy_rwlock); read_unlock(&policy_rwlock);
kfree(scontext2); kfree(scontext2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment