From cf1de7e6b79ea1543088dd462b2c80292f9543bb Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Thu, 7 Nov 2024 08:28:34 -0800 Subject: [PATCH] Fixed ZAM memory leak when coercing values to "any" --- src/script_opt/ZAM/OPs/coercions.op | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/script_opt/ZAM/OPs/coercions.op b/src/script_opt/ZAM/OPs/coercions.op index fef6ea8096..9f9af52ebd 100644 --- a/src/script_opt/ZAM/OPs/coercions.op +++ b/src/script_opt/ZAM/OPs/coercions.op @@ -128,7 +128,9 @@ eval if ( $1->Size() > 0 ) unary-expr-op To-Any-Coerce op-type X set-type $1 -eval AssignTarget($$, ZVal($1.ToVal(Z_TYPE), ZAM::any_base_type)) +eval auto orig_lhs = $$; /* hold in case $$ = $1 */ + $$ = ZVal($1.ToVal(Z_TYPE), ZAM::any_base_type); + ZVal::DeleteManagedType(orig_lhs); unary-expr-op From-Any-Coerce no-const