File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,13 @@ void common_hal_displayio_bitmap_construct_from_buffer(displayio_bitmap_t *self,
3131 self -> stride = stride (width , bits_per_value );
3232 self -> data_alloc = false;
3333 if (!data ) {
34- data = m_malloc (self -> stride * height * sizeof (uint32_t ));
34+ size_t bitmap_bytes = self -> stride * height * sizeof (uint32_t );
35+ data = port_malloc (bitmap_bytes , false);
36+ if (data == NULL ) {
37+ m_malloc_fail (bitmap_bytes );
38+ } else {
39+ memset (data , 0x00 , bitmap_bytes );
40+ }
3541 self -> data_alloc = true;
3642 }
3743 self -> data = data ;
@@ -64,7 +70,7 @@ void common_hal_displayio_bitmap_construct_from_buffer(displayio_bitmap_t *self,
6470
6571void common_hal_displayio_bitmap_deinit (displayio_bitmap_t * self ) {
6672 if (self -> data_alloc ) {
67- gc_free (self -> data );
73+ port_free (self -> data );
6874 }
6975 self -> data = NULL ;
7076}
You can’t perform that action at this time.
0 commit comments