Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754977AbdDJPgS (ORCPT ); Mon, 10 Apr 2017 11:36:18 -0400 Received: from mx2.suse.de ([195.135.220.15]:38043 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754821AbdDJPfD (ORCPT ); Mon, 10 Apr 2017 11:35:03 -0400 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Dan Carpenter , "Rafael J . Wysocki" , Jiri Slaby Subject: [PATCH 3.12 130/142] ACPI / resources: free memory on error in add_region_before() Date: Mon, 10 Apr 2017 17:33:31 +0200 Message-Id: X-Mailer: git-send-email 2.12.2 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1008 Lines: 36 From: Dan Carpenter 3.12-stable review patch. If anyone has any objections, please let me know. =============== commit 7bc10388ccdd79b3d20463151a1f8e7a590a775b upstream. There is a small memory leak on error. Fixes: 0f1b414d1907 (ACPI / PNP: Avoid conflicting resource reservations) Signed-off-by: Dan Carpenter Signed-off-by: Rafael J. Wysocki Signed-off-by: Jiri Slaby --- drivers/acpi/resource.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index 28314ba82320..3760e9635aea 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -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; -- 2.12.2