From: Dan Carpenter Date: Wed, 24 Jun 2015 14:30:15 +0000 (+0300) Subject: ACPI / resources: free memory on error in add_region_before() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7bc10388ccdd;p=linux-beck.git ACPI / resources: free memory on error in add_region_before() There is a small memory leak on error. Fixes: 0f1b414d1907 (ACPI / PNP: Avoid conflicting resource reservations) Cc: All applicable Signed-off-by: Dan Carpenter Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index fcb7807ea8b7..10561ce16ed1 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;