提交 a7f988ba 编写于 作者: J Jesper Juhl 提交者: Linus Torvalds

[PATCH] kfree cleanup: security

This is the security/ part of the big kfree cleanup patch.

Remove pointless checks for NULL prior to calling kfree() in security/.
Signed-off-by: NJesper Juhl <jesper.juhl@gmail.com>
Acked-by: NJames Morris <jmorris@namei.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 b2325fe1
......@@ -115,8 +115,7 @@ struct key_user *key_user_lookup(uid_t uid)
found:
atomic_inc(&user->usage);
spin_unlock(&key_user_lock);
if (candidate)
kfree(candidate);
kfree(candidate);
out:
return user;
......
......@@ -632,22 +632,22 @@ void policydb_destroy(struct policydb *p)
cond_policydb_destroy(p);
for (tr = p->role_tr; tr; tr = tr->next) {
if (ltr) kfree(ltr);
kfree(ltr);
ltr = tr;
}
if (ltr) kfree(ltr);
kfree(ltr);
for (ra = p->role_allow; ra; ra = ra -> next) {
if (lra) kfree(lra);
kfree(lra);
lra = ra;
}
if (lra) kfree(lra);
kfree(lra);
for (rt = p->range_tr; rt; rt = rt -> next) {
if (lrt) kfree(lrt);
kfree(lrt);
lrt = rt;
}
if (lrt) kfree(lrt);
kfree(lrt);
if (p->type_attr_map) {
for (i = 0; i < p->p_types.nprim; i++)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册