diff options
author | RongQing.Li <roy.qing.li@gmail.com> | 2011-11-14 14:37:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-14 14:37:24 -0500 |
commit | ad79eefc42d56cb851a2b28a86e481cf1161005e (patch) | |
tree | cb56aa7a35eb44121379f4e44e63d99caad50490 /net/ipv4/ipconfig.c | |
parent | 5219e4c93c281377700206ae2b3ba4d91653d2ba (diff) |
ipv4: fix a memory leak in ic_bootp_send_if
when dev_hard_header() failed, the newly allocated skb should be freed.
Signed-off-by: RongQing.Li <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipconfig.c')
-rw-r--r-- | net/ipv4/ipconfig.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 0da2afc97f32..7f17ba8b0318 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -822,8 +822,13 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d | |||
822 | skb->dev = dev; | 822 | skb->dev = dev; |
823 | skb->protocol = htons(ETH_P_IP); | 823 | skb->protocol = htons(ETH_P_IP); |
824 | if (dev_hard_header(skb, dev, ntohs(skb->protocol), | 824 | if (dev_hard_header(skb, dev, ntohs(skb->protocol), |
825 | dev->broadcast, dev->dev_addr, skb->len) < 0 || | 825 | dev->broadcast, dev->dev_addr, skb->len) < 0) { |
826 | dev_queue_xmit(skb) < 0) | 826 | kfree_skb(skb); |
827 | printk("E"); | ||
828 | return; | ||
829 | } | ||
830 | |||
831 | if (dev_queue_xmit(skb) < 0) | ||
827 | printk("E"); | 832 | printk("E"); |
828 | } | 833 | } |
829 | 834 | ||