mirror of https://github.com/arendst/Tasmota.git
Berry safeguard when freeing null pointer (#18735)
This commit is contained in:
parent
fe570a1b26
commit
b053cf87ec
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue