diff options
author | Robert Moore <Robert.Moore@intel.com> | 2008-09-11 13:06:41 -0700 |
---|---|---|
committer | Robert Moore <Robert.Moore@intel.com> | 2008-09-11 13:06:41 -0700 |
commit | 6a16af9dd206b56434c06ca3c48939b9b8f58fa0 (patch) | |
tree | 17e0801a58375aa6b01637585550af26efb1e098 /source/components | |
parent | 232169228a970983a9d5ce4d7fd82e199f200979 (diff) | |
download | acpica-6a16af9dd206b56434c06ca3c48939b9b8f58fa0.tar.gz |
Fix fault after mem allocation failure in AML parser.
Fixes a crash if a memory allocation fails during the Op completion
routine AcpiPsCompleteThisOp. Lin Ming. BZ 492.
Diffstat (limited to 'source/components')
-rw-r--r-- | source/components/parser/psparse.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/source/components/parser/psparse.c b/source/components/parser/psparse.c index 135111966..ea57ceda0 100644 --- a/source/components/parser/psparse.c +++ b/source/components/parser/psparse.c @@ -222,6 +222,7 @@ AcpiPsCompleteThisOp ( ACPI_PARSE_OBJECT *Next; const ACPI_OPCODE_INFO *ParentInfo; ACPI_PARSE_OBJECT *ReplacementOp = NULL; + ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE_PTR (PsCompleteThisOp, Op); @@ -274,7 +275,7 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; } break; @@ -294,7 +295,7 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; } } else if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) && @@ -307,11 +308,13 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; + } + else + { + ReplacementOp->Named.Data = Op->Named.Data; + ReplacementOp->Named.Length = Op->Named.Length; } - - ReplacementOp->Named.Data = Op->Named.Data; - ReplacementOp->Named.Length = Op->Named.Length; } } break; @@ -321,7 +324,7 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; } } @@ -379,15 +382,7 @@ Cleanup: /* Now we can actually delete the subtree rooted at Op */ AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (AE_OK); - - -AllocateError: - - /* Always delete the subtree, even on error */ - - AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS (Status); } |