summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-06-24 16:30:15 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-06-24 19:52:34 +0200
commit7bc10388ccdd79b3d20463151a1f8e7a590a775b (patch)
treeb8a4839a2ed55804273bfe6818bfd676f8cf13c2 /drivers/acpi
parentACPI / PNP: Avoid conflicting resource reservations (diff)
downloadlinux-7bc10388ccdd79b3d20463151a1f8e7a590a775b.tar.xz
linux-7bc10388ccdd79b3d20463151a1f8e7a590a775b.zip
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>
Diffstat (limited to 'drivers/acpi')
-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 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;