summaryrefslogtreecommitdiffstatshomepage
path: root/py/objfun.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/objfun.c')
-rw-r--r--py/objfun.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/py/objfun.c b/py/objfun.c
index 187bb5a59e..70b897b57d 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -161,7 +161,10 @@ mp_code_state *mp_obj_fun_bc_prepare_codestate(mp_obj_t self_in, mp_uint_t n_arg
// allocate state for locals and stack
mp_uint_t state_size = n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack_t);
mp_code_state *code_state;
- code_state = m_new_obj_var(mp_code_state, byte, state_size);
+ code_state = m_new_obj_var_maybe(mp_code_state, byte, state_size);
+ if (!code_state) {
+ return NULL;
+ }
code_state->n_state = n_state;
code_state->ip = ip;