summaryrefslogtreecommitdiff
path: root/py/objfun.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-02-16 11:41:28 +1100
committerDamien George <damien@micropython.org>2024-02-19 23:40:54 +1100
commit24234937747e6d7fd920d21358fb26b826398e1a (patch)
tree7f6662dc0889b5a1c051fc1b12cb7c8077584fd3 /py/objfun.c
parent9242e3d16d34dd15f1cd868681be45432b443c5a (diff)
py/obj: Change sizeof to offsetof in mp_obj_malloc_var macro.
Following b6a977848407a4ced45d118cf926bd915cc89dfb, to properly calculate the size of the variable-length allocation. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/objfun.c')
-rw-r--r--py/objfun.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objfun.c b/py/objfun.c
index e2136968b..930d0ccdf 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -384,7 +384,7 @@ mp_obj_t mp_obj_new_fun_bc(const mp_obj_t *def_args, const byte *code, const mp_
def_kw_args = def_args[1];
n_extra_args += 1;
}
- mp_obj_fun_bc_t *o = mp_obj_malloc_var(mp_obj_fun_bc_t, mp_obj_t, n_extra_args, &mp_type_fun_bc);
+ mp_obj_fun_bc_t *o = mp_obj_malloc_var(mp_obj_fun_bc_t, extra_args, mp_obj_t, n_extra_args, &mp_type_fun_bc);
o->bytecode = code;
o->context = context;
o->child_table = child_table;