diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2025-09-08 16:26:58 +0200 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2025-09-17 09:25:17 -0400 |
| commit | 42b6ec0149fbf97d79ddd4d957cecc0fc08f2701 (patch) | |
| tree | c0a774892ac17026479f98aa0821286381c9aea8 | |
| parent | 74075617b17ab80db74a5e7c1c8515601a8ce6f4 (diff) | |
Clear memory for newly allocated iseq
| -rw-r--r-- | iseq.h | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -175,7 +175,12 @@ ISEQ_COMPILE_DATA_CLEAR(rb_iseq_t *iseq) static inline rb_iseq_t * iseq_imemo_alloc(void) { - return IMEMO_NEW(rb_iseq_t, imemo_iseq, 0); + rb_iseq_t *iseq = IMEMO_NEW(rb_iseq_t, imemo_iseq, 0); + + // Clear out the whole iseq except for the flags. + memset((char *)iseq + sizeof(VALUE), 0, sizeof(rb_iseq_t) - sizeof(VALUE)); + + return iseq; } VALUE rb_iseq_ibf_dump(const rb_iseq_t *iseq, VALUE opt); |
