* [patch] ACPI / resources: free memory on error in add_region_before()
@ 2015-06-24 14:30 Dan Carpenter
2015-06-24 21:57 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-06-24 14:30 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi, kernel-janitors
There is a small memory leak on error.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index fcb7807..10561ce 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -660,8 +660,10 @@ static int add_region_before(u64 start, u64 end, u8 space_id,
return -ENOMEM;
error = request_range(start, end, space_id, flags, desc);
- if (error)
+ if (error) {
+ kfree(reg);
return error;
+ }
reg->start = start;
reg->end = end;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] ACPI / resources: free memory on error in add_region_before()
2015-06-24 14:30 [patch] ACPI / resources: free memory on error in add_region_before() Dan Carpenter
@ 2015-06-24 21:57 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2015-06-24 21:57 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Len Brown, linux-acpi, kernel-janitors
On Wednesday, June 24, 2015 05:30:15 PM Dan Carpenter wrote:
> There is a small memory leak on error.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks!
> diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
> index fcb7807..10561ce 100644
> --- a/drivers/acpi/resource.c
> +++ b/drivers/acpi/resource.c
> @@ -660,8 +660,10 @@ static int add_region_before(u64 start, u64 end, u8 space_id,
> return -ENOMEM;
>
> error = request_range(start, end, space_id, flags, desc);
> - if (error)
> + if (error) {
> + kfree(reg);
> return error;
> + }
>
> reg->start = start;
> reg->end = end;
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-24 21:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-24 14:30 [patch] ACPI / resources: free memory on error in add_region_before() Dan Carpenter
2015-06-24 21:57 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox