Skip to content

Commit

Permalink
PicoVector: Remove malloc from MicroPython bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Jul 11, 2024
1 parent e5f5537 commit a8ef3ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions micropython/modules/picovector/picovector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ mp_obj_t VECTOR_draw(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)

pp_poly_t group;
group.count = num_polygons;
group.paths = (pp_path_t *)malloc(sizeof(pp_path_t) * num_polygons);
group.paths = (pp_path_t *)m_new(pp_path_t, num_polygons);

for(auto i = 0u; i < num_polygons; i++) {
mp_obj_t poly_obj = polygons[i];
Expand All @@ -534,7 +534,7 @@ mp_obj_t VECTOR_draw(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)

self->vector->draw(&group);

free(group.paths);
m_free(group.paths);

return mp_const_none;
}
Expand Down

0 comments on commit a8ef3ae

Please sign in to comment.