[rtl818x] Fix resource leak on error path
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
c24f772349
commit
ce240c8c2d
|
@ -663,7 +663,8 @@ int rtl818x_probe(struct pci_device *pdev )
|
||||||
hwinfo = zalloc(sizeof(*hwinfo));
|
hwinfo = zalloc(sizeof(*hwinfo));
|
||||||
if (!hwinfo) {
|
if (!hwinfo) {
|
||||||
DBG("rtl818x: hwinfo alloc failed\n");
|
DBG("rtl818x: hwinfo alloc failed\n");
|
||||||
return -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
goto err_alloc_hwinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
adjust_pci_device(pdev);
|
adjust_pci_device(pdev);
|
||||||
|
@ -671,7 +672,8 @@ int rtl818x_probe(struct pci_device *pdev )
|
||||||
dev = net80211_alloc(sizeof(*priv));
|
dev = net80211_alloc(sizeof(*priv));
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
DBG("rtl818x: net80211 alloc failed\n");
|
DBG("rtl818x: net80211 alloc failed\n");
|
||||||
return -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
goto err_alloc_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv = dev->priv;
|
priv = dev->priv;
|
||||||
|
@ -816,7 +818,9 @@ int rtl818x_probe(struct pci_device *pdev )
|
||||||
err_free_dev:
|
err_free_dev:
|
||||||
pci_set_drvdata(pdev, NULL);
|
pci_set_drvdata(pdev, NULL);
|
||||||
net80211_free(dev);
|
net80211_free(dev);
|
||||||
|
err_alloc_dev:
|
||||||
free(hwinfo);
|
free(hwinfo);
|
||||||
|
err_alloc_hwinfo:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue