Skip to content

Commit 6df7b2f

Browse files
committed
extmod/machine_signal: Change VLA to use new scoped allocation API.
1 parent 1e5a33d commit 6df7b2f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

extmod/machine_signal.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, size_t
5858
// If first argument isn't a Pin-like object, we filter out "invert"
5959
// from keyword arguments and pass them all to the exported Pin
6060
// constructor to create one.
61-
mp_obj_t pin_args[n_args + n_kw * 2];
61+
mp_obj_t *pin_args = mp_local_alloc((n_args + n_kw * 2) * sizeof(mp_obj_t));
6262
memcpy(pin_args, args, n_args * sizeof(mp_obj_t));
6363
const mp_obj_t *src = args + n_args;
6464
mp_obj_t *dst = pin_args + n_args;
@@ -88,6 +88,8 @@ STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, size_t
8888
// will just ignore it as set a concrete type. If not, we'd need
8989
// to expose port's "default" pin type too.
9090
pin = MICROPY_PY_MACHINE_PIN_MAKE_NEW(NULL, n_args, n_kw, pin_args);
91+
92+
mp_local_free(pin_args);
9193
}
9294
else
9395
#endif

0 commit comments

Comments
 (0)