diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-06-19 14:39:31 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-07-19 15:51:42 -0400 |
commit | 17f9b896b06d314da890174584278dea8da7e0ce (patch) | |
tree | 122982da152fcadee9860d0f78323a09d26d2de4 /drivers/xen | |
parent | a867e5d6b362fc2982f19c5223f1946292643e57 (diff) |
xen/acpi: Fix potential memory leak.
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>
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/xen-acpi-processor.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c index 7ff2569e17ae..b590ee067fcd 100644 --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c | |||
@@ -520,15 +520,18 @@ static int __init xen_acpi_processor_init(void) | |||
520 | 520 | ||
521 | if (!pr_backup) { | 521 | if (!pr_backup) { |
522 | pr_backup = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); | 522 | pr_backup = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); |
523 | memcpy(pr_backup, _pr, sizeof(struct acpi_processor)); | 523 | if (pr_backup) |
524 | memcpy(pr_backup, _pr, sizeof(struct acpi_processor)); | ||
524 | } | 525 | } |
525 | (void)upload_pm_data(_pr); | 526 | (void)upload_pm_data(_pr); |
526 | } | 527 | } |
527 | rc = check_acpi_ids(pr_backup); | 528 | rc = check_acpi_ids(pr_backup); |
528 | if (rc) | ||
529 | goto err_unregister; | ||
530 | 529 | ||
531 | kfree(pr_backup); | 530 | kfree(pr_backup); |
531 | pr_backup = NULL; | ||
532 | |||
533 | if (rc) | ||
534 | goto err_unregister; | ||
532 | 535 | ||
533 | return 0; | 536 | return 0; |
534 | err_unregister: | 537 | err_unregister: |