From d587964d87a0e9a045c427eda03d0e9878c95ba5 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 19 May 2024 09:16:07 -0700 Subject: [PATCH] zero-init otherwise uninitialized unions --- StructFields.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StructFields.pm b/StructFields.pm index 2516088e9..62bfa7f21 100644 --- a/StructFields.pm +++ b/StructFields.pm @@ -671,7 +671,7 @@ sub emit_struct_fields($$;%) { } 'fields-' . $fields_group; # Needed for unions with fields with non-default ctors (e.g. bitfields) - emit "$name(){}"; + emit "$name(){memset(this, 0, sizeof($name));}"; return; }