Skip to content

Commit

Permalink
xen/acpi: Fix potential memory leak.
Browse files Browse the repository at this point in the history
Coverity points out that we do not free in one case the
pr_backup - and sure enough we forgot.

Found by Coverity (CID 401970)

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  • Loading branch information
Konrad Rzeszutek Wilk committed Jul 19, 2012
1 parent a867e5d commit 17f9b89
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/xen/xen-acpi-processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,15 +520,18 @@ static int __init xen_acpi_processor_init(void)

if (!pr_backup) {
pr_backup = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
memcpy(pr_backup, _pr, sizeof(struct acpi_processor));
if (pr_backup)
memcpy(pr_backup, _pr, sizeof(struct acpi_processor));
}
(void)upload_pm_data(_pr);
}
rc = check_acpi_ids(pr_backup);
if (rc)
goto err_unregister;

kfree(pr_backup);
pr_backup = NULL;

if (rc)
goto err_unregister;

return 0;
err_unregister:
Expand Down

0 comments on commit 17f9b89

Please sign in to comment.