fm10k: fix memory leak

This was detected by Coverity.
The function skb_cow_head leaves skb alone on failure, so caller needs
to free.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
stephen hemminger 2015-11-17 14:24:27 -08:00 committed by David S. Miller
parent 945fae44d3
commit 6f97532ef0
1 changed files with 3 additions and 1 deletions

View File

@ -627,8 +627,10 @@ static netdev_tx_t fm10k_xmit_frame(struct sk_buff *skb, struct net_device *dev)
/* verify the skb head is not shared */
err = skb_cow_head(skb, 0);
if (err)
if (err) {
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
/* locate vlan header */
vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN);