diff --git a/lib/libesp32/berry/src/be_mem.c b/lib/libesp32/berry/src/be_mem.c index 976afece1..3657fd951 100644 --- a/lib/libesp32/berry/src/be_mem.c +++ b/lib/libesp32/berry/src/be_mem.c @@ -66,6 +66,7 @@ BERRY_API void* be_realloc(bvm *vm, void *ptr, size_t old_size, size_t new_size) /* Case 2: deallocate */ else if (new_size == 0) { + if (ptr == NULL) { return NULL; } /* safeguard */ #if BE_USE_DEBUG_GC memset(ptr, 0xFF, old_size); /* fill the structure with invalid pointers */ #endif