Commit 8d6015e0 authored by Dan Carpenter's avatar Dan Carpenter Committed by Luis Henriques

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

commit 7bc10388 upstream.

There is a small memory leak on error.

Fixes: 0f1b414d (ACPI / PNP: Avoid conflicting resource reservations)
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 86a88cf3
......@@ -577,8 +577,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;
......
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