summaryrefslogtreecommitdiff
path: root/shared-module/_protomatter
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-04-03 10:55:14 -0500
committerJeff Epler <jepler@gmail.com>2020-04-14 18:24:58 -0500
commitcaea4e010fad5e17089fcfdd8dea13699c3727c1 (patch)
tree1f8b61c9a6e6a7d14984243fa81b28cc4ebb7a90 /shared-module/_protomatter
parent5fcba97a5185bd69c2213b38f6c8fc580dafde23 (diff)
deinit: Work harder to ensure storage is released at deinit
Diffstat (limited to 'shared-module/_protomatter')
-rw-r--r--shared-module/_protomatter/Protomatter.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/shared-module/_protomatter/Protomatter.c b/shared-module/_protomatter/Protomatter.c
index bec9586f8..59dac3e6d 100644
--- a/shared-module/_protomatter/Protomatter.c
+++ b/shared-module/_protomatter/Protomatter.c
@@ -163,7 +163,14 @@ void common_hal_protomatter_protomatter_deinit(protomatter_protomatter_obj_t* se
}
memset(&self->core, 0, sizeof(self->core));
+ // If it was supervisor-allocated, it is supervisor-freed and the pointer
+ // is zeroed, otherwise the pointer is just zeroed
+ _PM_FREE(self->bufinfo.buf);
self->base.type = NULL;
+
+ // If a framebuffer was passed in to the constructor, NULL the reference
+ // here so that it will become GC'able
+ self->framebuffer = NULL;
}
void protomatter_protomatter_collect_ptrs(protomatter_protomatter_obj_t* self) {