Fix NULL parameter for region

This commit is contained in:
Tilen Majerle 2021-05-04 07:57:26 +02:00 committed by GitHub
parent d6c62982aa
commit 3a9e5bd7bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -648,7 +648,7 @@ prv_realloc(lwmem_t* const lw, const lwmem_region_t* region, void* const ptr, co
* *
* Final solution is to find completely new empty block of sufficient size and copy content from old one to new one * Final solution is to find completely new empty block of sufficient size and copy content from old one to new one
*/ */
retval = prv_alloc(lw, NULL, size); /* Try to allocate new block */ retval = prv_alloc(lw, region, size); /* Try to allocate new block */
if (retval != NULL) { if (retval != NULL) {
block_size = (block->size & ~LWMEM_ALLOC_BIT) - LWMEM_BLOCK_META_SIZE; /* Get application size from input pointer */ block_size = (block->size & ~LWMEM_ALLOC_BIT) - LWMEM_BLOCK_META_SIZE; /* Get application size from input pointer */
LWMEM_MEMCPY(retval, ptr, size > block_size ? block_size : size); /* Copy content to new allocated block */ LWMEM_MEMCPY(retval, ptr, size > block_size ? block_size : size); /* Copy content to new allocated block */