Commit 7bc10388 authored by Dan Carpenter's avatar Dan Carpenter Committed by Rafael J. Wysocki

ACPI / resources: free memory on error in add_region_before()

There is a small memory leak on error.

Fixes: 0f1b414d (ACPI / PNP: Avoid conflicting resource reservations)
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 0f1b414d
...@@ -660,8 +660,10 @@ static int add_region_before(u64 start, u64 end, u8 space_id, ...@@ -660,8 +660,10 @@ static int add_region_before(u64 start, u64 end, u8 space_id,
return -ENOMEM; return -ENOMEM;
error = request_range(start, end, space_id, flags, desc); error = request_range(start, end, space_id, flags, desc);
if (error) if (error) {
kfree(reg);
return error; return error;
}
reg->start = start; reg->start = start;
reg->end = end; reg->end = end;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment