diff options
author | Jesper Juhl <jesper.juhl@gmail.com> | 2005-11-08 12:41:34 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-11-08 12:41:34 -0500 |
commit | a51482bde22f99c63fbbb57d5d46cc666384e379 (patch) | |
tree | 5482ed1c0803edb2ffbd51035de921fb0f72d82b /net/ipv6 | |
parent | ac7c98eca88a854755475fcfe1b2bf5f97f90d99 (diff) |
[NET]: kfree cleanup
From: Jesper Juhl <jesper.juhl@gmail.com>
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 <jesper.juhl@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 3 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 15 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 6 | ||||
-rw-r--r-- | net/ipv6/ipcomp6.c | 3 | ||||
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 3 |
5 files changed, 10 insertions, 20 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index a34d1504deb9..b7a5f51238b3 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -3090,8 +3090,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, | |||
3090 | 3090 | ||
3091 | nlmsg_failure: | 3091 | nlmsg_failure: |
3092 | rtattr_failure: | 3092 | rtattr_failure: |
3093 | if (array) | 3093 | kfree(array); |
3094 | kfree(array); | ||
3095 | skb_trim(skb, b - skb->data); | 3094 | skb_trim(skb, b - skb->data); |
3096 | return -1; | 3095 | return -1; |
3097 | } | 3096 | } |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 614296a920c6..dbd9767b32e4 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -587,8 +587,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
587 | skb->next = NULL; | 587 | skb->next = NULL; |
588 | } | 588 | } |
589 | 589 | ||
590 | if (tmp_hdr) | 590 | kfree(tmp_hdr); |
591 | kfree(tmp_hdr); | ||
592 | 591 | ||
593 | if (err == 0) { | 592 | if (err == 0) { |
594 | IP6_INC_STATS(IPSTATS_MIB_FRAGOKS); | 593 | IP6_INC_STATS(IPSTATS_MIB_FRAGOKS); |
@@ -1186,10 +1185,8 @@ int ip6_push_pending_frames(struct sock *sk) | |||
1186 | 1185 | ||
1187 | out: | 1186 | out: |
1188 | inet->cork.flags &= ~IPCORK_OPT; | 1187 | inet->cork.flags &= ~IPCORK_OPT; |
1189 | if (np->cork.opt) { | 1188 | kfree(np->cork.opt); |
1190 | kfree(np->cork.opt); | 1189 | np->cork.opt = NULL; |
1191 | np->cork.opt = NULL; | ||
1192 | } | ||
1193 | if (np->cork.rt) { | 1190 | if (np->cork.rt) { |
1194 | dst_release(&np->cork.rt->u.dst); | 1191 | dst_release(&np->cork.rt->u.dst); |
1195 | np->cork.rt = NULL; | 1192 | np->cork.rt = NULL; |
@@ -1214,10 +1211,8 @@ void ip6_flush_pending_frames(struct sock *sk) | |||
1214 | 1211 | ||
1215 | inet->cork.flags &= ~IPCORK_OPT; | 1212 | inet->cork.flags &= ~IPCORK_OPT; |
1216 | 1213 | ||
1217 | if (np->cork.opt) { | 1214 | kfree(np->cork.opt); |
1218 | kfree(np->cork.opt); | 1215 | np->cork.opt = NULL; |
1219 | np->cork.opt = NULL; | ||
1220 | } | ||
1221 | if (np->cork.rt) { | 1216 | if (np->cork.rt) { |
1222 | dst_release(&np->cork.rt->u.dst); | 1217 | dst_release(&np->cork.rt->u.dst); |
1223 | np->cork.rt = NULL; | 1218 | np->cork.rt = NULL; |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index cf94372d1af3..e6b0e3954c02 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -756,8 +756,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
756 | } | 756 | } |
757 | ip6_tnl_dst_store(t, dst); | 757 | ip6_tnl_dst_store(t, dst); |
758 | 758 | ||
759 | if (opt) | 759 | kfree(opt); |
760 | kfree(opt); | ||
761 | 760 | ||
762 | t->recursion--; | 761 | t->recursion--; |
763 | return 0; | 762 | return 0; |
@@ -766,8 +765,7 @@ tx_err_link_failure: | |||
766 | dst_link_failure(skb); | 765 | dst_link_failure(skb); |
767 | tx_err_dst_release: | 766 | tx_err_dst_release: |
768 | dst_release(dst); | 767 | dst_release(dst); |
769 | if (opt) | 768 | kfree(opt); |
770 | kfree(opt); | ||
771 | tx_err: | 769 | tx_err: |
772 | stats->tx_errors++; | 770 | stats->tx_errors++; |
773 | stats->tx_dropped++; | 771 | stats->tx_dropped++; |
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c index 85bfbc69b2c3..55917fb17094 100644 --- a/net/ipv6/ipcomp6.c +++ b/net/ipv6/ipcomp6.c | |||
@@ -130,8 +130,7 @@ static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, s | |||
130 | out_put_cpu: | 130 | out_put_cpu: |
131 | put_cpu(); | 131 | put_cpu(); |
132 | out: | 132 | out: |
133 | if (tmp_hdr) | 133 | kfree(tmp_hdr); |
134 | kfree(tmp_hdr); | ||
135 | if (err) | 134 | if (err) |
136 | goto error_out; | 135 | goto error_out; |
137 | return nexthdr; | 136 | return nexthdr; |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 8567873d0dd8..003fd99ff597 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -80,8 +80,7 @@ int ip6_ra_control(struct sock *sk, int sel, void (*destructor)(struct sock *)) | |||
80 | if (ra->sk == sk) { | 80 | if (ra->sk == sk) { |
81 | if (sel>=0) { | 81 | if (sel>=0) { |
82 | write_unlock_bh(&ip6_ra_lock); | 82 | write_unlock_bh(&ip6_ra_lock); |
83 | if (new_ra) | 83 | kfree(new_ra); |
84 | kfree(new_ra); | ||
85 | return -EADDRINUSE; | 84 | return -EADDRINUSE; |
86 | } | 85 | } |
87 | 86 | ||