File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -105,23 +105,23 @@ void free_memory(supervisor_allocation* allocation) {
105105 else {
106106 // Check if it's in the list of embedded allocations.
107107 supervisor_allocation_node * * emb = & MP_STATE_VM (first_embedded_allocation );
108- while (* emb != NULL ) {
109- if (* emb == node ) {
110- // Found, remove it from the list.
111- * emb = node -> next ;
112- m_free (node
108+ while (* emb != NULL && * emb != node ) {
109+ emb = & ((* emb )-> next );
110+ }
111+ if (* emb != NULL ) {
112+ // Found, remove it from the list.
113+ * emb = node -> next ;
114+ m_free (node
113115#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
114- , sizeof (supervisor_allocation_node ) + (node -> length & ~FLAGS )
116+ , sizeof (supervisor_allocation_node ) + (node -> length & ~FLAGS )
115117#endif
116- );
117- goto done ;
118- }
119- emb = & ((* emb )-> next );
118+ );
119+ }
120+ else {
121+ // Else it must be within the low or high ranges and becomes a hole.
122+ node -> length = ((node -> length & ~FLAGS ) | HOLE );
120123 }
121- // Else it must be within the low or high ranges and becomes a hole.
122- node -> length = ((node -> length & ~FLAGS ) | HOLE );
123124 }
124- done :
125125 allocation -> ptr = NULL ;
126126}
127127
You can’t perform that action at this time.
0 commit comments