mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
yam: fix possible memory leak in yam_init_driver
[ Upstream commit 98749b7188affbf2900c2aab704a8853901d1139 ] If register_netdev(dev) fails, free_netdev(dev) needs to be called, otherwise a memory leak will occur. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wang Hai <wanghai38@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6706e3e7f8
commit
11e1f4a586
@ -1162,6 +1162,7 @@ static int __init yam_init_driver(void)
|
||||
err = register_netdev(dev);
|
||||
if (err) {
|
||||
printk(KERN_WARNING "yam: cannot register net device %s\n", dev->name);
|
||||
free_netdev(dev);
|
||||
goto error;
|
||||
}
|
||||
yam_devs[i] = dev;
|
||||
|
Loading…
x
Reference in New Issue
Block a user