提交 2a6fae32 编写于 作者: A Alexander Beregalov 提交者: Mauro Carvalho Chehab

i7core_edac: fix memory leak of i7core_dev

Free already allocated i7core_dev.
Signed-off-by: NAlexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 71753e01
......@@ -1249,8 +1249,10 @@ int i7core_get_onedevice(struct pci_dev **prev, int devno,
return -ENOMEM;
i7core_dev->pdev = kzalloc(sizeof(*i7core_dev->pdev) * n_devs,
GFP_KERNEL);
if (!i7core_dev->pdev)
if (!i7core_dev->pdev) {
kfree(i7core_dev);
return -ENOMEM;
}
i7core_dev->socket = socket;
i7core_dev->n_devs = n_devs;
list_add_tail(&i7core_dev->list, &i7core_edac_list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册