Skip to content

Commit 6b95609

Browse files
committed
Fix mpy load. Collect raw code child pointers
1 parent 52ea6fe commit 6b95609

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

py/persistentcode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ static mp_raw_code_t *load_raw_code(mp_reader_t *reader, mp_module_context_t *co
318318
// Load children if any.
319319
if (has_children) {
320320
n_children = read_uint(reader);
321-
children = m_new(mp_raw_code_t *, n_children + (kind == MP_CODE_NATIVE_PY));
321+
// CIRCUITPY-CHANGE: Collect children pointers
322+
children = m_malloc_with_collect(sizeof(mp_raw_code_t *) * (n_children + (kind == MP_CODE_NATIVE_PY)));
322323
for (size_t i = 0; i < n_children; ++i) {
323324
children[i] = load_raw_code(reader, context);
324325
}

0 commit comments

Comments
 (0)