summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-06-24 17:30:15 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-06-24 19:52:34 +0200
commit7bc10388ccdd79b3d20463151a1f8e7a590a775b (patch)
treeb8a4839a2ed55804273bfe6818bfd676f8cf13c2
parent0f1b414d190724617eb1cdd615592fa8cd9d0b50 (diff)
downloadop-kernel-dev-7bc10388ccdd79b3d20463151a1f8e7a590a775b.zip
op-kernel-dev-7bc10388ccdd79b3d20463151a1f8e7a590a775b.tar.gz
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 <stable@vger.kernel.org> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/resource.c4
1 files changed, 3 insertions, 1 deletions
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;
OpenPOWER on IntegriCloud