summaryrefslogtreecommitdiffstatshomepage
path: root/py/gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/gc.c')
-rw-r--r--py/gc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/py/gc.c b/py/gc.c
index 5533b84334..c8256fb03b 100644
--- a/py/gc.c
+++ b/py/gc.c
@@ -332,6 +332,9 @@ void *gc_realloc(void *ptr, machine_uint_t n_bytes) {
} else {
// TODO check if we can grow inplace
void *ptr2 = gc_alloc(n_bytes);
+ if (ptr2 == NULL) {
+ return ptr2;
+ }
memcpy(ptr2, ptr, n_existing);
gc_free(ptr);
return ptr2;