mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-12 00:38:55 +00:00
i7core_edac: fix memory leak of i7core_dev
Free already allocated i7core_dev. Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
71753e0141
commit
2a6fae3267
@ -1249,8 +1249,10 @@ int i7core_get_onedevice(struct pci_dev **prev, int devno,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
i7core_dev->pdev = kzalloc(sizeof(*i7core_dev->pdev) * n_devs,
|
i7core_dev->pdev = kzalloc(sizeof(*i7core_dev->pdev) * n_devs,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!i7core_dev->pdev)
|
if (!i7core_dev->pdev) {
|
||||||
|
kfree(i7core_dev);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
i7core_dev->socket = socket;
|
i7core_dev->socket = socket;
|
||||||
i7core_dev->n_devs = n_devs;
|
i7core_dev->n_devs = n_devs;
|
||||||
list_add_tail(&i7core_dev->list, &i7core_edac_list);
|
list_add_tail(&i7core_dev->list, &i7core_edac_list);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user