Skip to content

Commit 9ee6ec6

Browse files
committed
don't gc_free() ringbuf if no heap
1 parent cf127df commit 9ee6ec6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

py/ringbuf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ bool ringbuf_alloc(ringbuf_t *r, size_t capacity, bool long_lived) {
4848
}
4949

5050
void ringbuf_free(ringbuf_t *r) {
51-
if (r->heap) {
51+
if (r->heap && gc_alloc_possible()) {
52+
// Only free if on the heap, and there is really a heap.
5253
gc_free(r->buf);
5354
}
5455
r->buf = (uint8_t *)NULL;

0 commit comments

Comments
 (0)