Merge pull request #295 from kkamagui/fix_operand_cache_memory_leak_in_acpi_ds_obj_stack_pop_and_delete

acpi: acpica: fix acpi operand cache leak in dsutils.c
This commit is contained in:
Saket Dumbre 2024-12-12 08:34:54 -08:00 committed by GitHub
commit 28b55ece2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -867,6 +867,8 @@ AcpiDsCreateOperands (
ACPI_PARSE_OBJECT *Arguments[ACPI_OBJ_NUM_OPERANDS];
UINT32 ArgCount = 0;
UINT32 Index = WalkState->NumOperands;
UINT32 PrevNumOperands = WalkState->NumOperands;
UINT32 NewNumOperands;
UINT32 i;
@ -899,6 +901,7 @@ AcpiDsCreateOperands (
/* Create the interpreter arguments, in reverse order */
NewNumOperands = Index;
Index--;
for (i = 0; i < ArgCount; i++)
{
@ -926,7 +929,11 @@ Cleanup:
* pop everything off of the operand stack and delete those
* objects
*/
AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
WalkState->NumOperands = i;
AcpiDsObjStackPopAndDelete (NewNumOperands, WalkState);
/* Restore operand count */
WalkState->NumOperands = PrevNumOperands;
ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %u", Index));
return_ACPI_STATUS (Status);