From: RongQing.Li Date: Mon, 14 Nov 2011 19:37:24 +0000 (-0500) Subject: ipv4: fix a memory leak in ic_bootp_send_if X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ad79eefc42d56cb851a2b28a86e481cf1161005e;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Signed-off-by: David S. Miller --- 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 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"); }