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:
  SELinux: memory leak in security_context_to_sid_core
  • Loading branch information
Linus Torvalds committed Sep 4, 2008
2 parents 3e25a2d + 8e531af commit d210baf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions security/selinux/ss/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d210baf

Please sign in to comment.