[NET]: kfree cleanup

From: Jesper Juhl <[email protected]>

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

Remove pointless checks for NULL prior to calling kfree() in net/.

Signed-off-by: Jesper Juhl <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Acked-by: Marcel Holtmann <[email protected]>
Acked-by: YOSHIFUJI Hideaki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
This commit is contained in:
Jesper Juhl 2005-11-08 09:41:34 -08:00 • committed by David S. Miller
commit a51482bde2
47 changed files with 99 additions and 191 deletions

View file

@ -3090,8 +3090,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
nlmsg_failure:
rtattr_failure:
if (array)
kfree(array);
kfree(array);
skb_trim(skb, b - skb->data);
return -1;
}

View file

@ -587,8 +587,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
skb->next = NULL;
}
if (tmp_hdr)
kfree(tmp_hdr);
kfree(tmp_hdr);
if (err == 0) {
IP6_INC_STATS(IPSTATS_MIB_FRAGOKS);
@ -1186,10 +1185,8 @@ int ip6_push_pending_frames(struct sock *sk)
out:
inet->cork.flags &= ~IPCORK_OPT;
if (np->cork.opt) {
kfree(np->cork.opt);
np->cork.opt = NULL;
}
kfree(np->cork.opt);
np->cork.opt = NULL;
if (np->cork.rt) {
dst_release(&np->cork.rt->u.dst);
np->cork.rt = NULL;
@ -1214,10 +1211,8 @@ void ip6_flush_pending_frames(struct sock *sk)
inet->cork.flags &= ~IPCORK_OPT;
if (np->cork.opt) {
kfree(np->cork.opt);
np->cork.opt = NULL;
}
kfree(np->cork.opt);
np->cork.opt = NULL;
if (np->cork.rt) {
dst_release(&np->cork.rt->u.dst);
np->cork.rt = NULL;

View file

@ -756,8 +756,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
}
ip6_tnl_dst_store(t, dst);
if (opt)
kfree(opt);
kfree(opt);
t->recursion--;
return 0;
@ -766,8 +765,7 @@ tx_err_link_failure:
dst_link_failure(skb);
tx_err_dst_release:
dst_release(dst);
if (opt)
kfree(opt);
kfree(opt);
tx_err:
stats->tx_errors++;
stats->tx_dropped++;

View file

@ -130,8 +130,7 @@ static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, s
out_put_cpu:
put_cpu();
out:
if (tmp_hdr)
kfree(tmp_hdr);
kfree(tmp_hdr);
if (err)
goto error_out;
return nexthdr;

View file

@ -80,8 +80,7 @@ int ip6_ra_control(struct sock *sk, int sel, void (*destructor)(struct sock *))
if (ra->sk == sk) {
if (sel>=0) {
write_unlock_bh(&ip6_ra_lock);
if (new_ra)
kfree(new_ra);
kfree(new_ra);
return -EADDRINUSE;
}