david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[rtl818x] Fix resource leak on error path

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2017-03-23 11:40:23 +02:00
parent c24f772349
commit ce240c8c2d
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}