summaryrefslogtreecommitdiffstatshomepage
path: root/py/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/gc.c')
-rw-r--r--py/gc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/py/gc.c b/py/gc.c
index 68b70ba182..24d8e1ac26 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -546,6 +546,12 @@ void *gc_realloc(void *ptr_in, mp_uint_t n_bytes) {
return gc_alloc(n_bytes, false);
}
+ // check for pure free
+ if (n_bytes == 0) {
+ gc_free(ptr_in);
+ return NULL;
+ }
+
mp_uint_t ptr = (mp_uint_t)ptr_in;
// sanity check the ptr