From 6387f6b7d487e2a77d753ad28c1074e39c17c3ca Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 5 Mar 2024 15:14:07 +0100 Subject: prog: fix resource leak during replaceArg() of union fields The replaced union field may contain resource references that must also be cleaned up. The bug was triggered via methods that patch conditional fields, so let's add stress tests for the conditional fields + resources combination. Reported-by: Paul Chaignon --- sys/test/expressions.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sys') diff --git a/sys/test/expressions.txt b/sys/test/expressions.txt index 16d5b96a7..1c1cfbca5 100644 --- a/sys/test/expressions.txt +++ b/sys/test/expressions.txt @@ -68,3 +68,14 @@ conditional_union_parent { } test$conditional_union(a ptr[in, conditional_union_parent]) + +resource cond_res[int32] + +test$create_cond_resource() cond_res + +conditional_resouce_struct { + f0 int8 + f1 cond_res (if[value[f0] == 1]) +} + +test$use_cond_resource(a ptr[in, conditional_resouce_struct]) -- cgit mrf-deployment