mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
yam: fix possible memory leak in yam_init_driver
If register_netdev(dev) fails, free_netdev(dev) needs
to be called, otherwise a memory leak will occur.
Fixes: 1da177e4c3
("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>
This commit is contained in:
parent
7cdee28c4e
commit
98749b7188
1 changed files with 1 additions and 0 deletions
|
@ -1133,6 +1133,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…
Reference in a new issue