diff options
| author | Konrad Rzeszutek Wilk <[email protected]> | 2012-06-19 18:39:31 +0000 |
|---|---|---|
| committer | Konrad Rzeszutek Wilk <[email protected]> | 2012-07-19 19:51:42 +0000 |
| commit | 17f9b896b06d314da890174584278dea8da7e0ce (patch) | |
| tree | 122982da152fcadee9860d0f78323a09d26d2de4 /drivers/xen/xen-acpi-processor.c | |
| parent | xen/mce: add .poll method for mcelog device driver (diff) | |
| download | kernel-17f9b896b06d314da890174584278dea8da7e0ce.tar.gz kernel-17f9b896b06d314da890174584278dea8da7e0ce.zip | |
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 <[email protected]>
Diffstat (limited to 'drivers/xen/xen-acpi-processor.c')
| -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) 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: |
