summaryrefslogtreecommitdiffstats
path: root/src/drivers/net
diff options
context:
space:
mode:
authorMichael Brown2017-03-23 10:40:23 +0100
committerMichael Brown2017-03-23 10:40:36 +0100
commitce240c8c2d5d51841e3b261951b181961215de6b (patch)
tree4d8dca105a8f9ad1e3f1b0f5372e6cd5b0b269da /src/drivers/net
parent[travis] Integrate with Coverity Scan (diff)
downloadipxe-ce240c8c2d5d51841e3b261951b181961215de6b.tar.gz
ipxe-ce240c8c2d5d51841e3b261951b181961215de6b.tar.xz
ipxe-ce240c8c2d5d51841e3b261951b181961215de6b.zip
[rtl818x] Fix resource leak on error path
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net')
-rw-r--r--src/drivers/net/rtl818x/rtl818x.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/drivers/net/rtl818x/rtl818x.c b/src/drivers/net/rtl818x/rtl818x.c
index 8b3c206d..f5082084 100644
--- a/src/drivers/net/rtl818x/rtl818x.c
+++ b/src/drivers/net/rtl818x/rtl818x.c
@@ -663,7 +663,8 @@ int rtl818x_probe(struct pci_device *pdev )
hwinfo = zalloc(sizeof(*hwinfo));
if (!hwinfo) {
DBG("rtl818x: hwinfo alloc failed\n");
- return -ENOMEM;
+ err = -ENOMEM;
+ goto err_alloc_hwinfo;
}
adjust_pci_device(pdev);
@@ -671,7 +672,8 @@ int rtl818x_probe(struct pci_device *pdev )
dev = net80211_alloc(sizeof(*priv));
if (!dev) {
DBG("rtl818x: net80211 alloc failed\n");
- return -ENOMEM;
+ err = -ENOMEM;
+ goto err_alloc_dev;
}
priv = dev->priv;
@@ -816,7 +818,9 @@ int rtl818x_probe(struct pci_device *pdev )
err_free_dev:
pci_set_drvdata(pdev, NULL);
net80211_free(dev);
+ err_alloc_dev:
free(hwinfo);
+ err_alloc_hwinfo:
return err;
}