summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2025-09-12 15:01:02 -0400
committerPeter Zhu <peter@peterzhu.ca>2025-09-17 09:25:17 -0400
commita456e79e06faf36caac20d9b33e92a98613c9d07 (patch)
tree1e3bcf9253e6e3ac7cfc2fb12d53464b7e23a14c
parent3b2f698432350dadcb87fd4dfb11e1b2c31c36c7 (diff)
Clear out memory for newly allocated structs
-rw-r--r--struct.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/struct.c b/struct.c
index c53e68b3da..2076f5709e 100644
--- a/struct.c
+++ b/struct.c
@@ -837,6 +837,7 @@ struct_alloc(VALUE klass)
st->as.heap.ptr = struct_heap_alloc((VALUE)st, n);
rb_mem_clear((VALUE *)st->as.heap.ptr, n);
st->as.heap.len = n;
+ st->as.heap.fields_obj = 0;
return (VALUE)st;
}