From patchwork Fri Jan 9 09:26:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 1485 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n099NxNk003124 for ; Fri, 9 Jan 2009 01:24:40 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753442AbZAIJ2W (ORCPT ); Fri, 9 Jan 2009 04:28:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753633AbZAIJ2V (ORCPT ); Fri, 9 Jan 2009 04:28:21 -0500 Received: from vms173001pub.verizon.net ([206.46.173.1]:40934 "EHLO vms173001pub.verizon.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753442AbZAIJ2I (ORCPT ); Fri, 9 Jan 2009 04:28:08 -0500 Received: from localhost.localdomain ([96.237.168.40]) by vms173001.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0KD700LRJ6AKLN97@vms173001.mailsrvcs.net> for linux-acpi@vger.kernel.org; Fri, 09 Jan 2009 03:27:57 -0600 (CST) Received: from localhost.localdomain (d975xbx2 [127.0.0.1]) by localhost.localdomain (8.14.2/8.14.2) with ESMTP id n099Ru8I011883; Fri, 09 Jan 2009 04:27:56 -0500 Received: (from lenb@localhost) by localhost.localdomain (8.14.2/8.14.2/Submit) id n099RtcI011882; Fri, 09 Jan 2009 04:27:55 -0500 Date: Fri, 09 Jan 2009 04:26:23 -0500 From: Len Brown Subject: [PATCH 21/94] ACPICA: Fix possible memory leak on error in parser In-reply-to: <1231493256-11678-1-git-send-email-lenb@kernel.org> In-reply-to: To: linux-acpi@vger.kernel.org Cc: Lin Ming , Bob Moore , Len Brown Message-id: <84d4db7c528e23f8c9ae0be12960549347003eeb.1231492608.git.len.brown@intel.com> Organization: Intel Open Source Technology Center X-Mailer: git-send-email 1.6.1.76.gc123b References: <1231493256-11678-1-git-send-email-lenb@kernel.org> References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Lin Ming Fixes a possible memory leak if an allocation failure happens in the parse loop. Must terminate an executing control method. Lin Ming, Bob Moore. ACPICA BZ 489. http://www.acpica.org/bugzilla/show_bug.cgi?id=489 Signed-off-by: Lin Ming Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/parser/psparse.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 68e932f..dfd3d90 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c @@ -451,6 +451,14 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) thread = acpi_ut_create_thread_state(); if (!thread) { + if (walk_state->method_desc) { + + /* Executing a control method - additional cleanup */ + + acpi_ds_terminate_control_method( + walk_state->method_desc, walk_state); + } + acpi_ds_delete_walk_state(walk_state); return_ACPI_STATUS(AE_NO_MEMORY); }