summaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipconfig.c
diff options
context:
space:
mode:
authorRongQing.Li <roy.qing.li@gmail.com>2011-11-14 14:37:24 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-14 14:37:24 -0500
commitad79eefc42d56cb851a2b28a86e481cf1161005e (patch)
treecb56aa7a35eb44121379f4e44e63d99caad50490 /net/ipv4/ipconfig.c
parent5219e4c93c281377700206ae2b3ba4d91653d2ba (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.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 0da2afc97f3..7f17ba8b031 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
skb->dev = dev;
skb->protocol = htons(ETH_P_IP);
if (dev_hard_header(skb, dev, ntohs(skb->protocol),
- dev->broadcast, dev->dev_addr, skb->len) < 0 ||
- dev_queue_xmit(skb) < 0)
+ dev->broadcast, dev->dev_addr, skb->len) < 0) {
+ kfree_skb(skb);
+ printk("E");
+ return;
+ }
+
+ if (dev_queue_xmit(skb) < 0)
printk("E");
}