Skip to content

Commit 2858dac

Browse files
committed
deinit: Work harder to ensure storage is released at deinit
1 parent f38a07c commit 2858dac

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

shared-module/_protomatter/Protomatter.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,14 @@ void common_hal_protomatter_protomatter_deinit(protomatter_protomatter_obj_t* se
163163
}
164164
memset(&self->core, 0, sizeof(self->core));
165165

166+
// If it was supervisor-allocated, it is supervisor-freed and the pointer
167+
// is zeroed, otherwise the pointer is just zeroed
168+
_PM_FREE(self->bufinfo.buf);
166169
self->base.type = NULL;
170+
171+
// If a framebuffer was passed in to the constructor, NULL the reference
172+
// here so that it will become GC'able
173+
self->framebuffer = NULL;
167174
}
168175

169176
void protomatter_protomatter_collect_ptrs(protomatter_protomatter_obj_t* self) {

0 commit comments

Comments
 (0)