aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-03-05 15:14:07 +0100
committerAleksandr Nogikh <nogikh@google.com>2024-03-08 10:56:47 +0000
commit6387f6b7d487e2a77d753ad28c1074e39c17c3ca (patch)
treefeb7cac9b567eb2346a093e6b5a1962524b310ae /sys
parentcf82cde132b42c09ac539191ca2dfdab5d810c93 (diff)
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 <paul.chaignon@gmail.com>
Diffstat (limited to 'sys')
-rw-r--r--sys/test/expressions.txt11
1 files changed, 11 insertions, 0 deletions
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])