File tree 1 file changed +13
-13
lines changed
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) {
105
105
else {
106
106
// Check if it's in the list of embedded allocations.
107
107
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
113
115
#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
114
- , sizeof (supervisor_allocation_node ) + (node -> length & ~FLAGS )
116
+ , sizeof (supervisor_allocation_node ) + (node -> length & ~FLAGS )
115
117
#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 );
120
123
}
121
- // Else it must be within the low or high ranges and becomes a hole.
122
- node -> length = ((node -> length & ~FLAGS ) | HOLE );
123
124
}
124
- done :
125
125
allocation -> ptr = NULL ;
126
126
}
127
127
You can’t perform that action at this time.
0 commit comments