Skip to content

Commit

Permalink
ACPI / resources: free memory on error in add_region_before()
Browse files Browse the repository at this point in the history
There is a small memory leak on error.

Fixes: 0f1b414 (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>
  • Loading branch information
Dan Carpenter authored and Rafael J. Wysocki committed Jun 24, 2015
1 parent 0f1b414 commit 7bc1038
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/acpi/resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7bc1038

Please sign in to comment.