Skip to content

Commit

Permalink
i7core_edac: fix memory leak of i7core_dev
Browse files Browse the repository at this point in the history
Free already allocated i7core_dev.

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Alexander Beregalov authored and Mauro Carvalho Chehab committed May 18, 2010
1 parent 71753e0 commit 2a6fae3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/edac/i7core_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2a6fae3

Please sign in to comment.