mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-10-02 01:20:47 +09:00
drivers: net: ldpaa_eth: fix resource leak
if an error occurs in ldpaa_eth_init, need to free all resources before returning the error. Threfore, free net_dev before returning from ldpaa_eth_init. Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
d47cfdbd31
commit
4b0880d66b
@ -1074,6 +1074,7 @@ int ldpaa_eth_init(int dpmac_id, phy_interface_t enet_if)
|
|||||||
priv = (struct ldpaa_eth_priv *)malloc(sizeof(struct ldpaa_eth_priv));
|
priv = (struct ldpaa_eth_priv *)malloc(sizeof(struct ldpaa_eth_priv));
|
||||||
if (!priv) {
|
if (!priv) {
|
||||||
printf("ldpaa_eth_priv malloc() failed\n");
|
printf("ldpaa_eth_priv malloc() failed\n");
|
||||||
|
free(net_dev);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
memset(priv, 0, sizeof(struct ldpaa_eth_priv));
|
memset(priv, 0, sizeof(struct ldpaa_eth_priv));
|
||||||
|
Loading…
Reference in New Issue
Block a user