diff options
| author | Jeff Epler <jepler@gmail.com> | 2019-10-10 13:25:24 +0900 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2019-10-10 13:25:24 +0900 |
| commit | cd0ed65b290b2a09b5df55daf02f8f1b44a916d9 (patch) | |
| tree | 9781c32f35722511cb52a9ead12076867b891758 | |
| parent | 8fbe19b99335da7c9a17698908f709b02901d8fc (diff) | |
mp_obj_instance_make_new: clearer way to avoid null pointer dereference
| -rw-r--r-- | py/objtype.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objtype.c b/py/objtype.c index 52b38f013..0212a78da 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -336,7 +336,7 @@ mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self, size_t n_args, cons mp_obj_t *args2 = m_new(mp_obj_t, 1 + n_args + 2 * n_kw); args2[0] = MP_OBJ_FROM_PTR(self); memcpy(args2 + 1, args, n_args * sizeof(mp_obj_t)); - if (n_kw) { + if (kw_args) { // copy in kwargs memcpy(args2 + 1 + n_args, kw_args->table, 2 * n_kw * sizeof(mp_obj_t)); } |
