Skip to content

Commit cd0ed65

Browse files
committed
mp_obj_instance_make_new: clearer way to avoid null pointer dereference
1 parent 8fbe19b commit cd0ed65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

py/objtype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ mp_obj_t mp_obj_instance_make_new(const mp_obj_type_t *self, size_t n_args, cons
336336
mp_obj_t *args2 = m_new(mp_obj_t, 1 + n_args + 2 * n_kw);
337337
args2[0] = MP_OBJ_FROM_PTR(self);
338338
memcpy(args2 + 1, args, n_args * sizeof(mp_obj_t));
339-
if (n_kw) {
339+
if (kw_args) {
340340
// copy in kwargs
341341
memcpy(args2 + 1 + n_args, kw_args->table, 2 * n_kw * sizeof(mp_obj_t));
342342
}

0 commit comments

Comments
 (0)