Skip to content

Commit

Permalink
[rtl818x] Fix resource leak on error path
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Mar 23, 2017
1 parent c24f772 commit ce240c8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/drivers/net/rtl818x/rtl818x.c
Expand Up @@ -663,15 +663,17 @@ 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);

dev = net80211_alloc(sizeof(*priv));
if (!dev) {
DBG("rtl818x: net80211 alloc failed\n");
return -ENOMEM;
err = -ENOMEM;
goto err_alloc_dev;
}

priv = dev->priv;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit ce240c8

Please sign in to comment.